diff --git a/.editorconfig b/.editorconfig index 4af9e494..e53d75e4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,37 +3,15 @@ root = true [*] charset = utf-8 end_of_line = lf -indent_style = tab -indent_size = 4 -insert_final_newline = true -tab_width = 4 -trim_trailing_whitespace = false - -[*.md] indent_style = space indent_size = 2 +insert_final_newline = true +tab_width = 4 trim_trailing_whitespace = false -[*.{nix,yml,yaml}] -indent_style = space -indent_size = 2 -tab_width = 2 - -[*.yuck] -indent_style = spaces -indent_size = 4 - -[*.{js, sh}] -indent_style = spaces -indent_size = 2 - -[*.{diff,patch}] +[*.{diff,patch,lock}] +indent_size = unset +indent_size = unset end_of_line = unset insert_final_newline = unset trim_trailing_whitespace = unset - -[secrets.yaml] -indent_size = unset - -[*.lock] -indent_size = unset diff --git a/flake/templates/node/package.json b/flake/templates/node/package.json index d362ca6d..5fc1164a 100644 --- a/flake/templates/node/package.json +++ b/flake/templates/node/package.json @@ -1,19 +1,19 @@ { - "name": "sample-nodejs", - "version": "0.0.1", - "description": "Sample node program", - "bin": { - "sample-node": "build/index.js" - }, - "scripts": { - "build": "tsc", - "start": "npm run build && node build/index.js" - }, - "author": "NotAShelf", - "license": "MIT", - "devDependencies": { - "@types/node": "^20.1.2", - "typescript": "^5.0.4", - "typescript-language-server": "^3.3.2" - } + "name": "sample-nodejs", + "version": "0.0.1", + "description": "Sample node program", + "bin": { + "sample-node": "build/index.js" + }, + "scripts": { + "build": "tsc", + "start": "npm run build && node build/index.js" + }, + "author": "NotAShelf", + "license": "MIT", + "devDependencies": { + "@types/node": "^20.1.2", + "typescript": "^5.0.4", + "typescript-language-server": "^3.3.2" + } } diff --git a/flake/templates/node/tsconfig.json b/flake/templates/node/tsconfig.json index 0e48dd3a..b1b1c66e 100644 --- a/flake/templates/node/tsconfig.json +++ b/flake/templates/node/tsconfig.json @@ -1,16 +1,16 @@ { - "compilerOptions": { - "target": "es2016", - "lib": ["es6"], - "module": "commonjs", - "rootDir": "src", - "resolveJsonModule": true, - "allowJs": true, - "outDir": "build", - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - "strict": true, - "noImplicitAny": true, - "skipLibCheck": true - } + "compilerOptions": { + "target": "es2016", + "lib": ["es6"], + "module": "commonjs", + "rootDir": "src", + "resolveJsonModule": true, + "allowJs": true, + "outDir": "build", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitAny": true, + "skipLibCheck": true + } } diff --git a/home/isabel/programs/configs/editors/vscode/keybindings.json b/home/isabel/programs/configs/editors/vscode/keybindings.json index 56c50500..71a29b26 100644 --- a/home/isabel/programs/configs/editors/vscode/keybindings.json +++ b/home/isabel/programs/configs/editors/vscode/keybindings.json @@ -1,16 +1,16 @@ [ - { - "key": "ctrl+alt+up", - "command": "-editor.action.copyLinesUpAction", - "when": "editorTextFocus" - }, - { - "key": "ctrl+alt+down", - "command": "-editor.action.copyLinesDownAction", - "when": "editorTextFocus" - }, - { - "key": "ctrl+m", - "command": "-editor.action.toggleTabFocusMode" - } + { + "key": "ctrl+alt+up", + "command": "-editor.action.copyLinesUpAction", + "when": "editorTextFocus" + }, + { + "key": "ctrl+alt+down", + "command": "-editor.action.copyLinesDownAction", + "when": "editorTextFocus" + }, + { + "key": "ctrl+m", + "command": "-editor.action.toggleTabFocusMode" + } ] diff --git a/home/isabel/programs/configs/editors/vscode/settings.json b/home/isabel/programs/configs/editors/vscode/settings.json index 488d0ac4..82e7a418 100644 --- a/home/isabel/programs/configs/editors/vscode/settings.json +++ b/home/isabel/programs/configs/editors/vscode/settings.json @@ -1,50 +1,50 @@ { - "security.workspace.trust.untrustedFiles": "open", - "editor.suggestSelection": "first", - "editor.formatOnPaste": true, - "explorer.confirmDragAndDrop": false, - "files.autoSave": "onWindowChange", - "editor.multiCursorModifier": "ctrlCmd", - "git.autofetch": true, - "git.confirmSync": false, - "git.ignoreRebaseWarning": true, - "git.enableSmartCommit": true, - "editor.guides.bracketPairs": true, - "editor.guides.bracketPairsHorizontal": true, - "emmet.triggerExpansionOnTab": true, - "editor.inlineSuggest.enabled": true, - "github.copilot.enable": { - "*": true - }, - "editor.accessibilitySupport": "off", - "editor.fontFamily": "JetBrainsMono Nerd Font Mono", - "terminal.integrated.fontSize": 16, - "editor.linkedEditing": true, - "workbench.startupEditor": "none", - "markdown-preview-enhanced.liveUpdate": true, - "editor.formatOnSave": true, - "explorer.confirmDelete": false, - "workbench.settings.applyToAllProfiles": [], - "workbench.iconTheme": "catppuccin-mocha", - "window.titleBarStyle": "custom", - "nix.enableLanguageServer": true, - "nix.serverPath": "nil", - // using flakes with `formatter = pkgs.alejandra;` - "nix.formatterPath": ["nix", "fmt", "--", "-"], - "nix.serverSettings": { - // settings for 'nil' LSP - "nil": { - "formatting": { - "command": ["alejandra"] - } - } - }, - "workbench.editor.empty.hint": "hidden", - "arduino.useArduinoCli": true, - "arduino.enableUSBDetection": true, - "[css]": { - "editor.defaultFormatter": "stylelint.vscode-stylelint" - }, - "workbench.colorTheme": "Catppuccin Mocha", - "catppuccin.accentColor": "sapphire" + "security.workspace.trust.untrustedFiles": "open", + "editor.suggestSelection": "first", + "editor.formatOnPaste": true, + "explorer.confirmDragAndDrop": false, + "files.autoSave": "onWindowChange", + "editor.multiCursorModifier": "ctrlCmd", + "git.autofetch": true, + "git.confirmSync": false, + "git.ignoreRebaseWarning": true, + "git.enableSmartCommit": true, + "editor.guides.bracketPairs": true, + "editor.guides.bracketPairsHorizontal": true, + "emmet.triggerExpansionOnTab": true, + "editor.inlineSuggest.enabled": true, + "github.copilot.enable": { + "*": true + }, + "editor.accessibilitySupport": "off", + "editor.fontFamily": "JetBrainsMono Nerd Font Mono", + "terminal.integrated.fontSize": 16, + "editor.linkedEditing": true, + "workbench.startupEditor": "none", + "markdown-preview-enhanced.liveUpdate": true, + "editor.formatOnSave": true, + "explorer.confirmDelete": false, + "workbench.settings.applyToAllProfiles": [], + "workbench.iconTheme": "catppuccin-mocha", + "window.titleBarStyle": "custom", + "nix.enableLanguageServer": true, + "nix.serverPath": "nil", + // using flakes with `formatter = pkgs.alejandra;` + "nix.formatterPath": ["nix", "fmt", "--", "-"], + "nix.serverSettings": { + // settings for 'nil' LSP + "nil": { + "formatting": { + "command": ["alejandra"] + } + } + }, + "workbench.editor.empty.hint": "hidden", + "arduino.useArduinoCli": true, + "arduino.enableUSBDetection": true, + "[css]": { + "editor.defaultFormatter": "stylelint.vscode-stylelint" + }, + "workbench.colorTheme": "Catppuccin Mocha", + "catppuccin.accentColor": "sapphire" } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/config.js b/home/isabel/programs/configs/gui/bars/ags/config/config.js index 150c87ed..2bb8656a 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/config.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/config.js @@ -14,23 +14,23 @@ import options from "./options.js"; initWallpaper(); const windows = () => [ - forMonitors(TopBar), - // forMonitors(LeftBar), - forMonitors(OSD), - forMonitors(Notifications), - Applauncher(), - Dashboard(), - QuickSettings(), - PowerMenu(), + forMonitors(TopBar), + // forMonitors(LeftBar), + forMonitors(OSD), + forMonitors(Notifications), + Applauncher(), + Dashboard(), + QuickSettings(), + PowerMenu(), ]; export default { - onConfigParsed: init, - windows: windows().flat(1), - maxStreamVolume: 1.05, - cacheNotificationActions: true, - closeWindowDelay: { - quicksettings: options.transition.value, - dashboard: options.transition.value, - }, + onConfigParsed: init, + windows: windows().flat(1), + maxStreamVolume: 1.05, + cacheNotificationActions: true, + closeWindowDelay: { + quicksettings: options.transition.value, + dashboard: options.transition.value, + }, }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/icons.js b/home/isabel/programs/configs/gui/bars/ags/config/icons.js index 1798d0a5..f937169b 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/icons.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/icons.js @@ -1,121 +1,121 @@ export default { - lock: "system-lock-screen-symbolic", - fallback: { - executable: "application-x-executable-symbolic", + lock: "system-lock-screen-symbolic", + fallback: { + executable: "application-x-executable-symbolic", + }, + audio: { + mic: { + muted: "microphone-disabled-symbolic", + low: "microphone-sensitivity-low-symbolic", + medium: "microphone-sensitivity-medium-symbolic", + high: "microphone-sensitivity-high-symbolic", }, - audio: { - mic: { - muted: "microphone-disabled-symbolic", - low: "microphone-sensitivity-low-symbolic", - medium: "microphone-sensitivity-medium-symbolic", - high: "microphone-sensitivity-high-symbolic", - }, - volume: { - muted: "audio-volume-muted-symbolic", - low: "audio-volume-low-symbolic", - medium: "audio-volume-medium-symbolic", - high: "audio-volume-high-symbolic", - overamplified: "audio-volume-overamplified-symbolic", - }, - type: { - headset: "audio-headphones-symbolic", - speaker: "audio-speakers-symbolic", - card: "audio-card-symbolic", - }, - mixer: "", + volume: { + muted: "audio-volume-muted-symbolic", + low: "audio-volume-low-symbolic", + medium: "audio-volume-medium-symbolic", + high: "audio-volume-high-symbolic", + overamplified: "audio-volume-overamplified-symbolic", }, - asusctl: { - profile: { - Balanced: "power-profile-balanced-symbolic", - Quiet: "power-profile-power-saver-symbolic", - Performance: "power-profile-performance-symbolic", - }, - mode: { - Integrated: "", - Hybrid: "󰢮", - }, + type: { + headset: "audio-headphones-symbolic", + speaker: "audio-speakers-symbolic", + card: "audio-card-symbolic", }, - apps: { - apps: "view-app-grid-symbolic", - search: "folder-saved-search-symbolic", + mixer: "", + }, + asusctl: { + profile: { + Balanced: "power-profile-balanced-symbolic", + Quiet: "power-profile-power-saver-symbolic", + Performance: "power-profile-performance-symbolic", }, - battery: { - charging: "󱐋", - warning: "battery-empty-symbolic", + mode: { + Integrated: "", + Hybrid: "󰢮", }, - bluetooth: { - enabled: "bluetooth-active-symbolic", - disabled: "bluetooth-disabled-symbolic", + }, + apps: { + apps: "view-app-grid-symbolic", + search: "folder-saved-search-symbolic", + }, + battery: { + charging: "󱐋", + warning: "battery-empty-symbolic", + }, + bluetooth: { + enabled: "bluetooth-active-symbolic", + disabled: "bluetooth-disabled-symbolic", + }, + brightness: { + indicator: "display-brightness-symbolic", + keyboard: "keyboard-brightness-symbolic", + screen: "display-brightness-symbolic", + }, + powermenu: { + sleep: "weather-clear-night-symbolic", + reboot: "system-reboot-symbolic", + logout: "system-log-out-symbolic", + shutdown: "system-shutdown-symbolic", + }, + recorder: { + recording: "media-record-symbolic", + }, + notifications: { + noisy: "preferences-system-notifications-symbolic", + silent: "notifications-disabled-symbolic", + }, + trash: { + full: "user-trash-full-symbolic", + empty: "user-trash-symbolic", + }, + mpris: { + fallback: "audio-x-generic-symbolic", + shuffle: { + enabled: "󰒟", + disabled: "󰒟", }, - brightness: { - indicator: "display-brightness-symbolic", - keyboard: "keyboard-brightness-symbolic", - screen: "display-brightness-symbolic", + loop: { + none: "󰓦", + track: "󰓦", + playlist: "󰑐", }, - powermenu: { - sleep: "weather-clear-night-symbolic", - reboot: "system-reboot-symbolic", - logout: "system-log-out-symbolic", - shutdown: "system-shutdown-symbolic", - }, - recorder: { - recording: "media-record-symbolic", - }, - notifications: { - noisy: "preferences-system-notifications-symbolic", - silent: "notifications-disabled-symbolic", - }, - trash: { - full: "user-trash-full-symbolic", - empty: "user-trash-symbolic", - }, - mpris: { - fallback: "audio-x-generic-symbolic", - shuffle: { - enabled: "󰒟", - disabled: "󰒟", - }, - loop: { - none: "󰓦", - track: "󰓦", - playlist: "󰑐", - }, - playing: "󰏦", - paused: "󰐍", - stopped: "󰐍", - prev: "󰒮", - next: "󰒭", - }, - ui: { - close: "window-close-symbolic", - info: "info-symbolic", - menu: "open-menu-symbolic", - link: "external-link-symbolic", - settings: "emblem-system-symbolic", - tick: "object-select-symbolic", - arrow: { - right: "pan-end-symbolic", - left: "pan-start-symbolic", - down: "pan-down-symbolic", - up: "pan-up-symbolic", - }, - }, - system: { - cpu: "org.gnome.SystemMonitor-symbolic", - ram: "drive-harddisk-solidstate-symbolic", - temp: "temperature-symbolic", - }, - dialog: { - Search: "", - Applauncher: "󰵆", - Bar: "", - Border: "󰃇", - Color: "󰏘", - Desktop: "", - Font: "", - General: "󰒓", - Miscellaneous: "󰠱", - Theme: "󰃟", - Notifications: "󰂚 ", + playing: "󰏦", + paused: "󰐍", + stopped: "󰐍", + prev: "󰒮", + next: "󰒭", + }, + ui: { + close: "window-close-symbolic", + info: "info-symbolic", + menu: "open-menu-symbolic", + link: "external-link-symbolic", + settings: "emblem-system-symbolic", + tick: "object-select-symbolic", + arrow: { + right: "pan-end-symbolic", + left: "pan-start-symbolic", + down: "pan-down-symbolic", + up: "pan-up-symbolic", }, + }, + system: { + cpu: "org.gnome.SystemMonitor-symbolic", + ram: "drive-harddisk-solidstate-symbolic", + temp: "temperature-symbolic", + }, + dialog: { + Search: "", + Applauncher: "󰵆", + Bar: "", + Border: "󰃇", + Color: "󰏘", + Desktop: "", + Font: "", + General: "󰒓", + Miscellaneous: "󰠱", + Theme: "󰃟", + Notifications: "󰂚 ", + }, }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/Avatar.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/Avatar.js index b0049324..41764c89 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/Avatar.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/Avatar.js @@ -3,24 +3,24 @@ import options from "../options.js"; /** @param {import('types/widgets/box').BoxProps=} props */ export default (props) => - Widget.Box({ - ...props, - class_name: "avatar", - connections: [ - [ - options.desktop.avatar, - (box) => - box.setCss(` + Widget.Box({ + ...props, + class_name: "avatar", + connections: [ + [ + options.desktop.avatar, + (box) => + box.setCss(` background-image: url('${options.desktop.avatar.value}'); background-size: cover; `), - ], - [ - "draw", - (box) => { - const h = box.get_allocated_height(); - box.set_size_request(h, -1); - }, - ], - ], - }); + ], + [ + "draw", + (box) => { + const h = box.get_allocated_height(); + box.set_size_request(h, -1); + }, + ], + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/BatteryIcon.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/BatteryIcon.js index ec4737b0..754f0611 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/BatteryIcon.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/BatteryIcon.js @@ -2,17 +2,17 @@ import Widget from "resource:///com/github/Aylur/ags/widget.js"; import Battery from "resource:///com/github/Aylur/ags/service/battery.js"; export default () => - Widget.Icon({ - class_name: "battery", - binds: [["icon", Battery, "icon-name"]], - connections: [ - [ - Battery, - (icon) => { - icon.toggleClassName("charging", Battery.charging); - icon.toggleClassName("charged", Battery.charged); - icon.toggleClassName("low", Battery.percent < 30); - }, - ], - ], - }); + Widget.Icon({ + class_name: "battery", + binds: [["icon", Battery, "icon-name"]], + connections: [ + [ + Battery, + (icon) => { + icon.toggleClassName("charging", Battery.charging); + icon.toggleClassName("charged", Battery.charged); + icon.toggleClassName("low", Battery.percent < 30); + }, + ], + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/Clock.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/Clock.js index 3a461882..5ab4f7e7 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/Clock.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/Clock.js @@ -8,20 +8,19 @@ import GLib from "gi://GLib"; * }} o */ export default ({ - format = "%H:%M:%S %B %e. %A", - interval = 1000, - ...rest + format = "%H:%M:%S %B %e. %A", + interval = 1000, + ...rest } = {}) => - Widget.Label({ - class_name: "clock", - ...rest, - connections: [ - [ - interval, - (label) => - (label.label = - GLib.DateTime.new_now_local().format(format) || - "wrong format"), - ], - ], - }); + Widget.Label({ + class_name: "clock", + ...rest, + connections: [ + [ + interval, + (label) => + (label.label = + GLib.DateTime.new_now_local().format(format) || "wrong format"), + ], + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/FontIcon.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/FontIcon.js index df64ce19..0db15deb 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/FontIcon.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/FontIcon.js @@ -3,44 +3,44 @@ import GObject from "gi://GObject"; import AgsLabel from "resource:///com/github/Aylur/ags/widgets/label.js"; class FontIcon extends AgsLabel { - static { - GObject.registerClass(this); - } - - /** @param {string | import('types/widgets/label').Props & { icon?: string }} params */ - constructor(params = "") { - const { icon = "", ...rest } = params; - super(typeof params === "string" ? {} : rest); - this.toggleClassName("font-icon"); - - if (typeof params === "object") this.icon = icon; - - if (typeof params === "string") this.icon = params; - } - - get icon() { - return this.label; - } - set icon(icon) { - this.label = icon; - } - - get size() { - return this.get_style_context().get_property( - "font-size", - Gtk.StateFlags.NORMAL, - ); - } - - /** @returns {[number, number]} */ - vfunc_get_preferred_height() { - return [this.size, this.size]; - } - - /** @returns {[number, number]} */ - vfunc_get_preferred_width() { - return [this.size, this.size]; - } + static { + GObject.registerClass(this); + } + + /** @param {string | import('types/widgets/label').Props & { icon?: string }} params */ + constructor(params = "") { + const { icon = "", ...rest } = params; + super(typeof params === "string" ? {} : rest); + this.toggleClassName("font-icon"); + + if (typeof params === "object") this.icon = icon; + + if (typeof params === "string") this.icon = params; + } + + get icon() { + return this.label; + } + set icon(icon) { + this.label = icon; + } + + get size() { + return this.get_style_context().get_property( + "font-size", + Gtk.StateFlags.NORMAL, + ); + } + + /** @returns {[number, number]} */ + vfunc_get_preferred_height() { + return [this.size, this.size]; + } + + /** @returns {[number, number]} */ + vfunc_get_preferred_width() { + return [this.size, this.size]; + } } /** @param {string | import('types/widgets/label').Props & { icon?: string }} params */ diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/HoverRevealer.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/HoverRevealer.js index b6dec08b..8d31fea3 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/HoverRevealer.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/HoverRevealer.js @@ -15,50 +15,50 @@ import * as Utils from "resource:///com/github/Aylur/ags/utils.js"; * @param {HoverRevealProps} props */ export default ({ - indicator, - child, - direction = "left", - duration = 300, - connections = [], - eventboxConnections = [], - binds = [], - ...rest + indicator, + child, + direction = "left", + duration = 300, + connections = [], + eventboxConnections = [], + binds = [], + ...rest }) => { - let open = false; - const vertical = direction === "down" || direction === "up"; - const posStart = direction === "down" || direction === "right"; - const posEnd = direction === "up" || direction === "left"; + let open = false; + const vertical = direction === "down" || direction === "up"; + const posStart = direction === "down" || direction === "right"; + const posEnd = direction === "up" || direction === "left"; - const revealer = Widget.Revealer({ - transition: `slide_${direction}`, - connections, - binds, - transition_duration: duration, - child, - }); + const revealer = Widget.Revealer({ + transition: `slide_${direction}`, + connections, + binds, + transition_duration: duration, + child, + }); - const eventbox = Widget.EventBox({ - ...rest, - connections: eventboxConnections, - on_hover: () => { - if (open) return; + const eventbox = Widget.EventBox({ + ...rest, + connections: eventboxConnections, + on_hover: () => { + if (open) return; - revealer.reveal_child = true; - Utils.timeout(duration, () => (open = true)); - }, - on_hover_lost: () => { - if (!open) return; + revealer.reveal_child = true; + Utils.timeout(duration, () => (open = true)); + }, + on_hover_lost: () => { + if (!open) return; - revealer.reveal_child = false; - open = false; - }, - child: Widget.Box({ - vertical, - children: [posStart && indicator, revealer, posEnd && indicator], - }), - }); + revealer.reveal_child = false; + open = false; + }, + child: Widget.Box({ + vertical, + children: [posStart && indicator, revealer, posEnd && indicator], + }), + }); - return Widget.Box({ - children: [eventbox], - }); + return Widget.Box({ + children: [eventbox], + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/IconBrowser.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/IconBrowser.js index 301e0ef7..bfb3b8bf 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/IconBrowser.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/IconBrowser.js @@ -3,61 +3,61 @@ import RegularWindow from "./RegularWindow.js"; import Gtk from "gi://Gtk"; export default () => { - const selected = Widget.Label({ - css: "font-size: 1.2em;", - }); + const selected = Widget.Label({ + css: "font-size: 1.2em;", + }); - const flowbox = Widget.FlowBox({ - min_children_per_line: 10, - setup: (self) => { - self.connect("child-activated", (_, child) => { - selected.label = child.get_child().iconName; - }); + const flowbox = Widget.FlowBox({ + min_children_per_line: 10, + setup: (self) => { + self.connect("child-activated", (_, child) => { + selected.label = child.get_child().iconName; + }); - Gtk.IconTheme.get_default() - .list_icons(null) - .sort() - .map((icon) => { - !icon.endsWith(".symbolic") && - self.insert( - Widget.Icon({ - icon, - size: 38, - }), - -1, - ); - }); + Gtk.IconTheme.get_default() + .list_icons(null) + .sort() + .map((icon) => { + !icon.endsWith(".symbolic") && + self.insert( + Widget.Icon({ + icon, + size: 38, + }), + -1, + ); + }); - self.show_all(); - }, - }); + self.show_all(); + }, + }); - const entry = Widget.Entry({ - on_change: ({ text }) => - flowbox.get_children().forEach((child) => { - child.visible = child.get_child().iconName.includes(text); - }), - }); + const entry = Widget.Entry({ + on_change: ({ text }) => + flowbox.get_children().forEach((child) => { + child.visible = child.get_child().iconName.includes(text); + }), + }); - return RegularWindow({ - name: "icons", - visible: true, - child: Widget.Box({ - css: "padding: 30px;", - spacing: 20, - vertical: true, - children: [ - entry, - Widget.Scrollable({ - hscroll: "never", - vscroll: "always", - hexpand: true, - vexpand: true, - css: "min-width: 500px;" + "min-height: 500px;", - child: flowbox, - }), - selected, - ], + return RegularWindow({ + name: "icons", + visible: true, + child: Widget.Box({ + css: "padding: 30px;", + spacing: 20, + vertical: true, + children: [ + entry, + Widget.Scrollable({ + hscroll: "never", + vscroll: "always", + hexpand: true, + vexpand: true, + css: "min-width: 500px;" + "min-height: 500px;", + child: flowbox, }), - }); + selected, + ], + }), + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/Notification.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/Notification.js index 2d42df3f..878d1d31 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/Notification.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/Notification.js @@ -4,12 +4,12 @@ import GLib from "gi://GLib"; /** @param {import('types/service/notifications').Notification} n */ const NotificationIcon = ({ app_entry, app_icon, image }) => { - if (image) { - return Widget.Box({ - vpack: "start", - hexpand: false, - class_name: "icon img", - css: ` + if (image) { + return Widget.Box({ + vpack: "start", + hexpand: false, + class_name: "icon img", + css: ` background-image: url("${image}"); background-size: contain; background-repeat: no-repeat; @@ -17,116 +17,116 @@ const NotificationIcon = ({ app_entry, app_icon, image }) => { min-width: 78px; min-height: 78px; `, - }); - } + }); + } - let icon = "dialog-information-symbolic"; - if (Utils.lookUpIcon(app_icon)) icon = app_icon; + let icon = "dialog-information-symbolic"; + if (Utils.lookUpIcon(app_icon)) icon = app_icon; - if (Utils.lookUpIcon(app_entry || "")) icon = app_entry || ""; + if (Utils.lookUpIcon(app_entry || "")) icon = app_entry || ""; - return Widget.Box({ - vpack: "start", - hexpand: false, - class_name: "icon", - css: ` + return Widget.Box({ + vpack: "start", + hexpand: false, + class_name: "icon", + css: ` min-width: 78px; min-height: 78px; `, - child: Widget.Icon({ - icon, - size: 58, - hpack: "center", - hexpand: true, - vpack: "center", - vexpand: true, - }), - }); + child: Widget.Icon({ + icon, + size: 58, + hpack: "center", + hexpand: true, + vpack: "center", + vexpand: true, + }), + }); }; /** @param {import('types/service/notifications').Notification} notification */ export default (notification) => { - const content = Widget.Box({ - class_name: "content", + const content = Widget.Box({ + class_name: "content", + children: [ + NotificationIcon(notification), + Widget.Box({ + hexpand: true, + vertical: true, children: [ - NotificationIcon(notification), - Widget.Box({ + Widget.Box({ + children: [ + Widget.Label({ + class_name: "title", + xalign: 0, + justification: "left", hexpand: true, - vertical: true, - children: [ - Widget.Box({ - children: [ - Widget.Label({ - class_name: "title", - xalign: 0, - justification: "left", - hexpand: true, - max_width_chars: 24, - truncate: "end", - wrap: true, - label: notification.summary, - use_markup: true, - }), - Widget.Label({ - class_name: "time", - vpack: "start", - label: GLib.DateTime.new_from_unix_local( - notification.time, - ).format("%H:%M"), - }), - Widget.Button({ - class_name: "close-button", - vpack: "start", - child: Widget.Icon("window-close-symbolic"), - on_clicked: () => notification.close(), - }), - ], - }), - Widget.Label({ - class_name: "description", - hexpand: true, - use_markup: true, - xalign: 0, - justification: "left", - label: notification.body, - wrap: true, - }), - ], - }), + max_width_chars: 24, + truncate: "end", + wrap: true, + label: notification.summary, + use_markup: true, + }), + Widget.Label({ + class_name: "time", + vpack: "start", + label: GLib.DateTime.new_from_unix_local( + notification.time, + ).format("%H:%M"), + }), + Widget.Button({ + class_name: "close-button", + vpack: "start", + child: Widget.Icon("window-close-symbolic"), + on_clicked: () => notification.close(), + }), + ], + }), + Widget.Label({ + class_name: "description", + hexpand: true, + use_markup: true, + xalign: 0, + justification: "left", + label: notification.body, + wrap: true, + }), ], - }); + }), + ], + }); - const actionsbox = Widget.Revealer({ - transition: "slide_down", - child: Widget.EventBox({ - child: Widget.Box({ - class_name: "actions horizontal", - children: notification.actions.map((action) => - Widget.Button({ - class_name: "action-button", - on_clicked: () => notification.invoke(action.id), - hexpand: true, - child: Widget.Label(action.label), - }), - ), - }), - }), - }); + const actionsbox = Widget.Revealer({ + transition: "slide_down", + child: Widget.EventBox({ + child: Widget.Box({ + class_name: "actions horizontal", + children: notification.actions.map((action) => + Widget.Button({ + class_name: "action-button", + on_clicked: () => notification.invoke(action.id), + hexpand: true, + child: Widget.Label(action.label), + }), + ), + }), + }), + }); - return Widget.EventBox({ - class_name: `notification ${notification.urgency}`, - vexpand: false, - on_primary_click: () => notification.dismiss(), - on_hover() { - actionsbox.reveal_child = true; - }, - on_hover_lost() { - actionsbox.reveal_child = true; - notification.dismiss(); - }, - child: Widget.Box({ - vertical: true, - children: [content, notification.actions.length > 0 && actionsbox], - }), - }); + return Widget.EventBox({ + class_name: `notification ${notification.urgency}`, + vexpand: false, + on_primary_click: () => notification.dismiss(), + on_hover() { + actionsbox.reveal_child = true; + }, + on_hover_lost() { + actionsbox.reveal_child = true; + notification.dismiss(); + }, + child: Widget.Box({ + vertical: true, + children: [content, notification.actions.length > 0 && actionsbox], + }), + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/OSD.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/OSD.js index d853ee04..5bf44cd5 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/OSD.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/OSD.js @@ -5,81 +5,73 @@ import Progress from "../misc/Progress.js"; import Indicator from "../services/onScreenIndicator.js"; export const OnScreenIndicator = ({ height = 300, width = 48 } = {}) => - Widget.Box({ - class_name: "indicator", - css: "padding: 1px;", - child: Widget.Revealer({ - transition: "slide_left", - connections: [ - [ - Indicator, - (revealer, value) => { - revealer.reveal_child = value > -1; - }, + Widget.Box({ + class_name: "indicator", + css: "padding: 1px;", + child: Widget.Revealer({ + transition: "slide_left", + connections: [ + [ + Indicator, + (revealer, value) => { + revealer.reveal_child = value > -1; + }, + ], + ], + child: Progress({ + width, + height, + vertical: true, + connections: [ + [Indicator, (progress, value) => progress.setValue(value)], + ], + child: Widget.Stack({ + vpack: "start", + hpack: "center", + hexpand: false, + items: [ + [ + "true", + Widget.Icon({ + hpack: "center", + size: width, + connections: [ + [Indicator, (icon, _v, name) => (icon.icon = name || "")], ], + }), ], - child: Progress({ - width, - height, - vertical: true, + [ + "false", + FontIcon({ + hpack: "center", + hexpand: true, + css: `font-size: ${width}px;`, connections: [ - [Indicator, (progress, value) => progress.setValue(value)], + [Indicator, (icon, _v, name) => (icon.icon = name || "")], ], - child: Widget.Stack({ - vpack: "start", - hpack: "center", - hexpand: false, - items: [ - [ - "true", - Widget.Icon({ - hpack: "center", - size: width, - connections: [ - [ - Indicator, - (icon, _v, name) => - (icon.icon = name || ""), - ], - ], - }), - ], - [ - "false", - FontIcon({ - hpack: "center", - hexpand: true, - css: `font-size: ${width}px;`, - connections: [ - [ - Indicator, - (icon, _v, name) => - (icon.icon = name || ""), - ], - ], - }), - ], - ], - connections: [ - [ - Indicator, - (stack, _v, name) => { - stack.shown = `${!!Utils.lookUpIcon(name)}`; - }, - ], - ], - }), - }), + }), + ], + ], + connections: [ + [ + Indicator, + (stack, _v, name) => { + stack.shown = `${!!Utils.lookUpIcon(name)}`; + }, + ], + ], }), - }); + }), + }), + }); /** @param {number} monitor */ export default (monitor) => - Widget.Window({ - name: `indicator${monitor}`, - monitor, - class_name: "indicator", - layer: "overlay", - anchor: ["right"], - child: OnScreenIndicator(), - }); + Widget.Window({ + name: `indicator${monitor}`, + monitor, + class_name: "indicator", + layer: "overlay", + anchor: ["right"], + child: OnScreenIndicator(), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/PopupWindow.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/PopupWindow.js index e08dd547..4ac338a7 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/PopupWindow.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/PopupWindow.js @@ -5,62 +5,55 @@ import options from "../options.js"; import GObject from "gi://GObject"; class PopupWindow2 extends AgsWindow { - static { - GObject.registerClass(this); - } + static { + GObject.registerClass(this); + } - /** @param {import('types/widgets/window').WindowProps & { - * name: string - * child: import('types/widgets/box').default - * transition?: import('types/widgets/revealer').RevealerProps['transition'] - * }} o - */ - constructor({ - name, - child, - transition = "none", - visible = false, - ...rest - }) { - super({ - ...rest, - name, - popup: true, - focusable: true, - class_names: ["popup-window", name], - }); + /** @param {import('types/widgets/window').WindowProps & { + * name: string + * child: import('types/widgets/box').default + * transition?: import('types/widgets/revealer').RevealerProps['transition'] + * }} o + */ + constructor({ name, child, transition = "none", visible = false, ...rest }) { + super({ + ...rest, + name, + popup: true, + focusable: true, + class_names: ["popup-window", name], + }); - child.toggleClassName("window-content"); - this.revealer = Widget.Revealer({ - transition, - child, - transitionDuration: options.transition.value, - connections: [ - [ - App, - (_, wname, visible) => { - if (wname === name) - this.revealer.reveal_child = visible; - }, - ], - ], - }); + child.toggleClassName("window-content"); + this.revealer = Widget.Revealer({ + transition, + child, + transitionDuration: options.transition.value, + connections: [ + [ + App, + (_, wname, visible) => { + if (wname === name) this.revealer.reveal_child = visible; + }, + ], + ], + }); - this.child = Widget.Box({ - css: "padding: 1px;", - child: this.revealer, - }); + this.child = Widget.Box({ + css: "padding: 1px;", + child: this.revealer, + }); - this.show_all(); - this.visible = visible; - } + this.show_all(); + this.visible = visible; + } - set transition(dir) { - this.revealer.transition = dir; - } - get transition() { - return this.revealer.transition; - } + set transition(dir) { + this.revealer.transition = dir; + } + get transition() { + return this.revealer.transition; + } } /** @param {import('types/widgets/window').WindowProps & { diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/Progress.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/Progress.js index 94277979..d7cccfc3 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/Progress.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/Progress.js @@ -2,56 +2,56 @@ import Widget from "resource:///com/github/Aylur/ags/widget.js"; import * as Utils from "resource:///com/github/Aylur/ags/utils.js"; export default ({ - height = 18, - width = 180, - vertical = false, - child, - ...props + height = 18, + width = 180, + vertical = false, + child, + ...props }) => { - const fill = Widget.Box({ - class_name: "fill", - hexpand: vertical, - vexpand: !vertical, - hpack: vertical ? "fill" : "start", - vpack: vertical ? "end" : "fill", - children: [child], - }); + const fill = Widget.Box({ + class_name: "fill", + hexpand: vertical, + vexpand: !vertical, + hpack: vertical ? "fill" : "start", + vpack: vertical ? "end" : "fill", + children: [child], + }); - let fill_size = 0; + let fill_size = 0; - return Widget.Box({ - ...props, - class_name: "progress", - css: ` + return Widget.Box({ + ...props, + class_name: "progress", + css: ` min-width: ${width}px; min-height: ${height}px; `, - children: [fill], - setup: (progress) => - (progress.setValue = (value) => { - if (value < 0) return; + children: [fill], + setup: (progress) => + (progress.setValue = (value) => { + if (value < 0) return; - const axis = vertical ? "height" : "width"; - const axisv = vertical ? height : width; - const min = vertical ? width : height; - const preferred = (axisv - min) * value + min; + const axis = vertical ? "height" : "width"; + const axisv = vertical ? height : width; + const min = vertical ? width : height; + const preferred = (axisv - min) * value + min; - if (!fill_size) { - fill_size = preferred; - fill.setCss(`min-${axis}: ${preferred}px;`); - return; - } + if (!fill_size) { + fill_size = preferred; + fill.setCss(`min-${axis}: ${preferred}px;`); + return; + } - const frames = 10; - const goal = preferred - fill_size; - const step = goal / frames; + const frames = 10; + const goal = preferred - fill_size; + const step = goal / frames; - for (let i = 0; i < frames; ++i) { - Utils.timeout(5 * i, () => { - fill_size += step; - fill.setCss(`min-${axis}: ${fill_size}px`); - }); - } - }), - }); + for (let i = 0; i < frames; ++i) { + Utils.timeout(5 * i, () => { + fill_size += step; + fill.setCss(`min-${axis}: ${fill_size}px`); + }); + } + }), + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/Spinner.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/Spinner.js index 726a7fa7..20f7fbc0 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/Spinner.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/Spinner.js @@ -1,7 +1,7 @@ import Widget from "resource:///com/github/Aylur/ags/widget.js"; export default (props) => - Widget.Spinner({ - ...props, - active: true, - }); + Widget.Spinner({ + ...props, + active: true, + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/misc/mpris.js b/home/isabel/programs/configs/gui/bars/ags/config/misc/mpris.js index 69c01352..b3a25a89 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/misc/mpris.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/misc/mpris.js @@ -10,187 +10,181 @@ const MEDIA_CACHE_PATH = Utils.CACHE_DIR + "/media"; * @param {import('types/widgets/box').BoxProps=} props */ export const CoverArt = (player, props) => - Widget.Box({ - ...props, - class_name: "cover", - binds: [ - [ - "css", - player, - "cover-path", - (path) => `background-image: url("${path}")`, - ], - ], - }); + Widget.Box({ + ...props, + class_name: "cover", + binds: [ + [ + "css", + player, + "cover-path", + (path) => `background-image: url("${path}")`, + ], + ], + }); /** * @param {import('types/service/mpris').MprisPlayer} player * @param {import('types/widgets/box').BoxProps=} props */ export const BlurredCoverArt = (player, props) => - Widget.Box({ - ...props, - class_name: "blurred-cover", - connections: [ - [ - player, - (box) => { - const url = player.cover_path; - if (!url) return; + Widget.Box({ + ...props, + class_name: "blurred-cover", + connections: [ + [ + player, + (box) => { + const url = player.cover_path; + if (!url) return; - const blurredPath = MEDIA_CACHE_PATH + "/blurred"; - const blurred = - blurredPath + url.substring(MEDIA_CACHE_PATH.length); + const blurredPath = MEDIA_CACHE_PATH + "/blurred"; + const blurred = blurredPath + url.substring(MEDIA_CACHE_PATH.length); - if (GLib.file_test(blurred, GLib.FileTest.EXISTS)) { - box.setCss(`background-image: url("${blurred}")`); - return; - } + if (GLib.file_test(blurred, GLib.FileTest.EXISTS)) { + box.setCss(`background-image: url("${blurred}")`); + return; + } - Utils.ensureDirectory(blurredPath); - Utils.execAsync(["convert", url, "-blur", "0x22", blurred]) - .then(() => - box.setCss(`background-image: url("${blurred}")`), - ) - .catch(() => {}); - }, - "notify::cover-path", - ], - ], - }); + Utils.ensureDirectory(blurredPath); + Utils.execAsync(["convert", url, "-blur", "0x22", blurred]) + .then(() => box.setCss(`background-image: url("${blurred}")`)) + .catch(() => {}); + }, + "notify::cover-path", + ], + ], + }); /** * @param {import('types/service/mpris').MprisPlayer} player * @param {import('types/widgets/label').Props=} props */ export const TitleLabel = (player, props) => - Widget.Label({ - ...props, - class_name: "title", - binds: [["label", player, "track-title"]], - }); + Widget.Label({ + ...props, + class_name: "title", + binds: [["label", player, "track-title"]], + }); /** * @param {import('types/service/mpris').MprisPlayer} player * @param {import('types/widgets/label').Props=} props */ export const ArtistLabel = (player, props) => - Widget.Label({ - ...props, - class_name: "artist", - binds: [["label", player, "track-artists", (a) => a.join(", ") || ""]], - }); + Widget.Label({ + ...props, + class_name: "artist", + binds: [["label", player, "track-artists", (a) => a.join(", ") || ""]], + }); /** * @param {import('types/service/mpris').MprisPlayer} player * @param {import('types/widgets/icon').Props & { symbolic?: boolean }=} props */ export const PlayerIcon = (player, { symbolic = true, ...props } = {}) => - Widget.Icon({ - ...props, - class_name: "player-icon", - tooltip_text: player.identity || "", - connections: [ - [ - player, - (icon) => { - const name = `${player.entry}${ - symbolic ? "-symbolic" : "" - }`; - Utils.lookUpIcon(name) - ? (icon.icon = name) - : (icon.icon = icons.mpris.fallback); - }, - ], - ], - }); + Widget.Icon({ + ...props, + class_name: "player-icon", + tooltip_text: player.identity || "", + connections: [ + [ + player, + (icon) => { + const name = `${player.entry}${symbolic ? "-symbolic" : ""}`; + Utils.lookUpIcon(name) + ? (icon.icon = name) + : (icon.icon = icons.mpris.fallback); + }, + ], + ], + }); /** * @param {import('types/service/mpris').MprisPlayer} player * @param {import('types/widgets/slider').SliderProps=} props */ export const PositionSlider = (player, props) => - Widget.Slider({ - ...props, - class_name: "position-slider", - draw_value: false, - on_change: ({ value }) => { - player.position = player.length * value; - }, - properties: [ - [ - "update", - (slider) => { - if (slider.dragging) return; + Widget.Slider({ + ...props, + class_name: "position-slider", + draw_value: false, + on_change: ({ value }) => { + player.position = player.length * value; + }, + properties: [ + [ + "update", + (slider) => { + if (slider.dragging) return; - slider.visible = player.length > 0; - if (player.length > 0) - slider.value = player.position / player.length; - }, - ], - ], - connections: [ - [player, (s) => s._update(s)], - [player, (s) => s._update(s), "position"], - [1000, (s) => s._update(s)], - ], - }); + slider.visible = player.length > 0; + if (player.length > 0) slider.value = player.position / player.length; + }, + ], + ], + connections: [ + [player, (s) => s._update(s)], + [player, (s) => s._update(s), "position"], + [1000, (s) => s._update(s)], + ], + }); /** @param {number} length */ function lengthStr(length) { - const min = Math.floor(length / 60); - const sec = Math.floor(length % 60); - const sec0 = sec < 10 ? "0" : ""; - return `${min}:${sec0}${sec}`; + const min = Math.floor(length / 60); + const sec = Math.floor(length % 60); + const sec0 = sec < 10 ? "0" : ""; + return `${min}:${sec0}${sec}`; } /** @param {import('types/service/mpris').MprisPlayer} player */ export const PositionLabel = (player) => - Widget.Label({ - properties: [ - [ - "update", - (label, time) => { - player.length > 0 - ? (label.label = lengthStr(time || player.position)) - : (label.visible = !!player); - }, - ], - ], - connections: [ - [player, (l, time) => l._update(l, time), "position"], - [1000, (l) => l._update(l)], - ], - }); + Widget.Label({ + properties: [ + [ + "update", + (label, time) => { + player.length > 0 + ? (label.label = lengthStr(time || player.position)) + : (label.visible = !!player); + }, + ], + ], + connections: [ + [player, (l, time) => l._update(l, time), "position"], + [1000, (l) => l._update(l)], + ], + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const LengthLabel = (player) => - Widget.Label({ - connections: [ - [ - player, - (label) => { - player.length > 0 - ? (label.label = lengthStr(player.length)) - : (label.visible = !!player); - }, - ], - ], - }); + Widget.Label({ + connections: [ + [ + player, + (label) => { + player.length > 0 + ? (label.label = lengthStr(player.length)) + : (label.visible = !!player); + }, + ], + ], + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const Slash = (player) => - Widget.Label({ - label: "/", - connections: [ - [ - player, - (label) => { - label.visible = player.length > 0; - }, - ], - ], - }); + Widget.Label({ + label: "/", + connections: [ + [ + player, + (label) => { + label.visible = player.length > 0; + }, + ], + ], + }); /** * @param {Object} o @@ -202,141 +196,141 @@ export const Slash = (player) => * @param {any} o.cantValue */ const PlayerButton = ({ player, items, onClick, prop, canProp, cantValue }) => - Widget.Button({ - child: Widget.Stack({ - items, - binds: [["shown", player, prop, (p) => `${p}`]], - }), - on_clicked: player[onClick].bind(player), - binds: [["visible", player, canProp, (c) => c !== cantValue]], - }); + Widget.Button({ + child: Widget.Stack({ + items, + binds: [["shown", player, prop, (p) => `${p}`]], + }), + on_clicked: player[onClick].bind(player), + binds: [["visible", player, canProp, (c) => c !== cantValue]], + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const ShuffleButton = (player) => - PlayerButton({ - player, - items: [ - [ - "true", - Widget.Label({ - class_name: "shuffle enabled", - label: icons.mpris.shuffle.enabled, - }), - ], - [ - "false", - Widget.Label({ - class_name: "shuffle disabled", - label: icons.mpris.shuffle.disabled, - }), - ], - ], - onClick: "shuffle", - prop: "shuffle-status", - canProp: "shuffle-status", - cantValue: null, - }); + PlayerButton({ + player, + items: [ + [ + "true", + Widget.Label({ + class_name: "shuffle enabled", + label: icons.mpris.shuffle.enabled, + }), + ], + [ + "false", + Widget.Label({ + class_name: "shuffle disabled", + label: icons.mpris.shuffle.disabled, + }), + ], + ], + onClick: "shuffle", + prop: "shuffle-status", + canProp: "shuffle-status", + cantValue: null, + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const LoopButton = (player) => - PlayerButton({ - player, - items: [ - [ - "None", - Widget.Label({ - class_name: "loop none", - label: icons.mpris.loop.none, - }), - ], - [ - "Track", - Widget.Label({ - class_name: "loop track", - label: icons.mpris.loop.track, - }), - ], - [ - "Playlist", - Widget.Label({ - class_name: "loop playlist", - label: icons.mpris.loop.playlist, - }), - ], - ], - onClick: "loop", - prop: "loop-status", - canProp: "loop-status", - cantValue: null, - }); + PlayerButton({ + player, + items: [ + [ + "None", + Widget.Label({ + class_name: "loop none", + label: icons.mpris.loop.none, + }), + ], + [ + "Track", + Widget.Label({ + class_name: "loop track", + label: icons.mpris.loop.track, + }), + ], + [ + "Playlist", + Widget.Label({ + class_name: "loop playlist", + label: icons.mpris.loop.playlist, + }), + ], + ], + onClick: "loop", + prop: "loop-status", + canProp: "loop-status", + cantValue: null, + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const PlayPauseButton = (player) => - PlayerButton({ - player, - items: [ - [ - "Playing", - Widget.Label({ - class_name: "playing", - label: icons.mpris.playing, - }), - ], - [ - "Paused", - Widget.Label({ - class_name: "paused", - label: icons.mpris.paused, - }), - ], - [ - "Stopped", - Widget.Label({ - class_name: "stopped", - label: icons.mpris.stopped, - }), - ], - ], - onClick: "playPause", - prop: "play-back-status", - canProp: "can-play", - cantValue: false, - }); + PlayerButton({ + player, + items: [ + [ + "Playing", + Widget.Label({ + class_name: "playing", + label: icons.mpris.playing, + }), + ], + [ + "Paused", + Widget.Label({ + class_name: "paused", + label: icons.mpris.paused, + }), + ], + [ + "Stopped", + Widget.Label({ + class_name: "stopped", + label: icons.mpris.stopped, + }), + ], + ], + onClick: "playPause", + prop: "play-back-status", + canProp: "can-play", + cantValue: false, + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const PreviousButton = (player) => - PlayerButton({ - player, - items: [ - [ - "true", - Widget.Label({ - class_name: "previous", - label: icons.mpris.prev, - }), - ], - ], - onClick: "previous", - prop: "can-go-prev", - canProp: "can-go-prev", - cantValue: false, - }); + PlayerButton({ + player, + items: [ + [ + "true", + Widget.Label({ + class_name: "previous", + label: icons.mpris.prev, + }), + ], + ], + onClick: "previous", + prop: "can-go-prev", + canProp: "can-go-prev", + cantValue: false, + }); /** @param {import('types/service/mpris').MprisPlayer} player */ export const NextButton = (player) => - PlayerButton({ - player, - items: [ - [ - "true", - Widget.Label({ - class_name: "next", - label: icons.mpris.next, - }), - ], - ], - onClick: "next", - prop: "can-go-next", - canProp: "can-go-next", - cantValue: false, - }); + PlayerButton({ + player, + items: [ + [ + "true", + Widget.Label({ + class_name: "next", + label: icons.mpris.next, + }), + ], + ], + onClick: "next", + prop: "can-go-next", + canProp: "can-go-next", + cantValue: false, + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/options.js b/home/isabel/programs/configs/gui/bars/ags/config/options.js index 0bdbe83c..63ab6fdc 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/options.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/options.js @@ -13,230 +13,230 @@ import { USER } from "resource:///com/github/Aylur/ags/utils.js"; import themes from "./themes.js"; export default { - reset: resetOptions, - values: getValues, - apply: apply, - - spacing: Option(9), - padding: Option(8), - radii: Option(15), - - popover_padding_multiplier: Option(1.4, { - category: "General", - note: "popover-padding: padding x this", - type: "float", - unit: "", + reset: resetOptions, + values: getValues, + apply: apply, + + spacing: Option(9), + padding: Option(8), + radii: Option(15), + + popover_padding_multiplier: Option(1.4, { + category: "General", + note: "popover-padding: padding x this", + type: "float", + unit: "", + }), + + font: { + font: Option("Ubuntu Nerd Font", { + type: "font", + title: "Font", + scss: "font", + }), + mono: Option("Mononoki Nerd Font", { + title: "Monospaced Font", + scss: "mono-font", + }), + size: Option(13, { + scss: "font-size", + unit: "pt", + }), + }, + + color: { + red: Option("#f38ba8", { scss: "red" }), + green: Option("#a6e3a1", { scss: "green" }), + yellow: Option("#f9e2af", { scss: "yellow" }), + blue: Option("#74c7ec", { scss: "blue" }), + magenta: Option("#cba6f7", { scss: "magenta" }), + teal: Option("#94e2d5", { scss: "teal" }), + orange: Option("#fab387", { scss: "orange" }), + }, + + theme: { + name: Option(themes[0].name, { + category: "exclude", + note: "Name to show as active in quicktoggles", }), - font: { - font: Option("Ubuntu Nerd Font", { - type: "font", - title: "Font", - scss: "font", - }), - mono: Option("Mononoki Nerd Font", { - title: "Monospaced Font", - scss: "mono-font", - }), - size: Option(13, { - scss: "font-size", - unit: "pt", - }), - }, + icon: Option(themes[0].icon, { + category: "exclude", + note: "Icon to show as active in quicktoggles", + }), - color: { - red: Option("#f38ba8", { scss: "red" }), - green: Option("#a6e3a1", { scss: "green" }), - yellow: Option("#f9e2af", { scss: "yellow" }), - blue: Option("#74c7ec", { scss: "blue" }), - magenta: Option("#cba6f7", { scss: "magenta" }), - teal: Option("#94e2d5", { scss: "teal" }), - orange: Option("#fab387", { scss: "orange" }), - }, + scheme: Option("dark", { + enums: ["dark", "light"], + type: "enum", + note: "Color scheme to set on Gtk apps: 'ligth' or 'dark'", + title: "Color Scheme", + scss: "color-scheme", + }), - theme: { - name: Option(themes[0].name, { - category: "exclude", - note: "Name to show as active in quicktoggles", - }), - - icon: Option(themes[0].icon, { - category: "exclude", - note: "Icon to show as active in quicktoggles", - }), - - scheme: Option("dark", { - enums: ["dark", "light"], - type: "enum", - note: "Color scheme to set on Gtk apps: 'ligth' or 'dark'", - title: "Color Scheme", - scss: "color-scheme", - }), - - bg: Option("#1e1e2e", { - title: "Background Color", - scss: "bg-color", - }), - fg: Option("#cdd6f4", { - title: "Foreground Color", - scss: "fg-color", - }), - - accent: { - accent: Option("$blue", { - category: "Theme", - title: "Accent Color", - scss: "accent", - }), - fg: Option("$bg-color", { - category: "Theme", - title: "Accent Foreground Color", - scss: "accent-fg", - }), - gradient: Option("to right, $accent, lighten($accent, 6%)", { - category: "Theme", - title: "Accent Linear Gradient", - scss: "accent-gradient", - }), - }, - - widget: { - bg: Option("$fg_color", { - category: "Theme", - title: "Widget Background Color", - scss: "_widget-bg", - }), - opacity: Option(94, { - category: "Theme", - title: "Widget Background Opacity", - unit: "", - scss: "widget-opacity", - }), - }, - }, + bg: Option("#1e1e2e", { + title: "Background Color", + scss: "bg-color", + }), + fg: Option("#cdd6f4", { + title: "Foreground Color", + scss: "fg-color", + }), - border: { - color: Option("$fg_color", { - category: "Border", - title: "Border Color", - scss: "_border-color", - }), - opacity: Option(97, { - category: "Border", - title: "Border Opacity", - unit: "", - }), - width: Option(1, { - category: "Border", - title: "Border Width", - }), + accent: { + accent: Option("$blue", { + category: "Theme", + title: "Accent Color", + scss: "accent", + }), + fg: Option("$bg-color", { + category: "Theme", + title: "Accent Foreground Color", + scss: "accent-fg", + }), + gradient: Option("to right, $accent, lighten($accent, 6%)", { + category: "Theme", + title: "Accent Linear Gradient", + scss: "accent-gradient", + }), }, - shadow: Option("rgba(0, 0, 0, .6)"), - drop_shadow: Option(true, { scss: "drop-shadow" }), - - hypr: { - wm_gaps: Option(8, { - category: "General", - scss: "wm-gaps", - note: "wm-gaps", - type: "float", - unit: "", - }), + widget: { + bg: Option("$fg_color", { + category: "Theme", + title: "Widget Background Color", + scss: "_widget-bg", + }), + opacity: Option(94, { + category: "Theme", + title: "Widget Background Opacity", + unit: "", + scss: "widget-opacity", + }), }, + }, - transition: Option(200, { - category: "exclude", - note: "Transition time on aminations in ms, e.g on hover", - unit: "ms", + border: { + color: Option("$fg_color", { + category: "Border", + title: "Border Color", + scss: "_border-color", }), + opacity: Option(97, { + category: "Border", + title: "Border Opacity", + unit: "", + }), + width: Option(1, { + category: "Border", + title: "Border Width", + }), + }, + + shadow: Option("rgba(0, 0, 0, .6)"), + drop_shadow: Option(true, { scss: "drop-shadow" }), + + hypr: { + wm_gaps: Option(8, { + category: "General", + scss: "wm-gaps", + note: "wm-gaps", + type: "float", + unit: "", + }), + }, + + transition: Option(200, { + category: "exclude", + note: "Transition time on aminations in ms, e.g on hover", + unit: "ms", + }), + + applauncher: { + width: Option(500), + height: Option(500), + icon_size: Option(52), + }, + + bar: { + position: Option("top", { + enums: ["top", "bottom"], + type: "enum", + }), + style: Option("floating", { + enums: ["floating", "normal", "separated"], + type: "enum", + }), + flat_buttons: Option(true, { scss: "bar-flat-buttons" }), + separators: Option(true), + icon: Option("distro-icon", { + note: '"distro-icon" or a single font', + }), + }, - applauncher: { - width: Option(500), - height: Option(500), - icon_size: Option(52), - }, - + battery: { + show_percentage: Option(true, { noReload: false, category: "exclude" }), bar: { - position: Option("top", { - enums: ["top", "bottom"], - type: "enum", - }), - style: Option("floating", { - enums: ["floating", "normal", "separated"], - type: "enum", - }), - flat_buttons: Option(true, { scss: "bar-flat-buttons" }), - separators: Option(true), - icon: Option("distro-icon", { - note: '"distro-icon" or a single font', - }), - }, - - battery: { - show_percentage: Option(true, { noReload: false, category: "exclude" }), - bar: { - width: Option(70, { category: "Bar" }), - height: Option(14, { category: "Bar" }), - }, - low: Option(25, { category: "Bar" }), - medium: Option(50, { category: "Bar" }), - }, - - desktop: { - avatar: Option(``, { - format: (v) => `"${v}"`, - }), - wallpaper: { - fg: Option("#fff", { scss: "wallpaper-fg" }), - img: Option(themes[0].options["desktop.wallpaper.img"], { - scssFormat: (v) => `"${v}"`, - type: "img", - }), - }, - avatar: Option(`/home/${USER}/media/pictures/pfps/avatar`, { - scssFormat: (v) => `"${v}"`, - type: "img", - note: "displayed in quicksettings and locksreen", - }), - drop_shadow: Option(true, { scss: "drop-shadow" }), - shadow: Option("rgba(0, 0, 0, .6)", { scss: "shadow" }), - }, - - notifications: { - black_list: Option(["Spotify"], { note: "app-name | entry" }), - position: Option(["top"], { note: "anchor" }), - width: Option(450), - }, - - dashboard: { - sys_info_size: Option(70, { - category: "Desktop", - scss: "sys-info-size", - }), + width: Option(70, { category: "Bar" }), + height: Option(14, { category: "Bar" }), }, + low: Option(25, { category: "Bar" }), + medium: Option(50, { category: "Bar" }), + }, - mpris: { - black_list: Option(["Caprine"], { - category: "Bar", - title: "List of blacklisted mpris players", - note: "filters for bus-name, name, identity, entry", - }), - preferred: Option("spotify", { - category: "Bar", - title: "Preferred player", - }), + desktop: { + avatar: Option(``, { + format: (v) => `"${v}"`, + }), + wallpaper: { + fg: Option("#fff", { scss: "wallpaper-fg" }), + img: Option(themes[0].options["desktop.wallpaper.img"], { + scssFormat: (v) => `"${v}"`, + type: "img", + }), }, + avatar: Option(`/home/${USER}/media/pictures/pfps/avatar`, { + scssFormat: (v) => `"${v}"`, + type: "img", + note: "displayed in quicksettings and locksreen", + }), + drop_shadow: Option(true, { scss: "drop-shadow" }), + shadow: Option("rgba(0, 0, 0, .6)", { scss: "shadow" }), + }, + + notifications: { + black_list: Option(["Spotify"], { note: "app-name | entry" }), + position: Option(["top"], { note: "anchor" }), + width: Option(450), + }, + + dashboard: { + sys_info_size: Option(70, { + category: "Desktop", + scss: "sys-info-size", + }), + }, - workspaces: Option(7, { - category: "Bar", - title: "No. workspaces on bar and overview", - note: "Set it to 0 to make it dynamic", + mpris: { + black_list: Option(["Caprine"], { + category: "Bar", + title: "List of blacklisted mpris players", + note: "filters for bus-name, name, identity, entry", }), + preferred: Option("spotify", { + category: "Bar", + title: "Preferred player", + }), + }, + + workspaces: Option(7, { + category: "Bar", + title: "No. workspaces on bar and overview", + note: "Set it to 0 to make it dynamic", + }), - // path to read temperature from - temperature: "/sys/class/thermal/thermal_zone0/temp", + // path to read temperature from + temperature: "/sys/class/thermal/thermal_zone0/temp", - // at what intervals should cpu, ram, temperature refresh - systemFetchInterval: 5000, + // at what intervals should cpu, ram, temperature refresh + systemFetchInterval: 5000, }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/button.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/button.scss index 1cdb96c3..e04e5710 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/button.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/button.scss @@ -1,113 +1,113 @@ @mixin button-focus() { - box-shadow: inset 0 0 0 $border-width $accent; - background-color: $hover; - color: $hover-fg; + box-shadow: inset 0 0 0 $border-width $accent; + background-color: $hover; + color: $hover-fg; } @mixin button-hover() { - box-shadow: inset 0 0 0 $border-width $border-color; - background-color: $hover; - color: $hover-fg; + box-shadow: inset 0 0 0 $border-width $border-color; + background-color: $hover; + color: $hover-fg; } @mixin button-active() { - box-shadow: inset 0 0 0 $border-width $border-color; - background-image: $active-gradient; - background-color: $accent; - color: $accent-fg; + box-shadow: inset 0 0 0 $border-width $border-color; + background-image: $active-gradient; + background-color: $accent; + color: $accent-fg; } @mixin button-disabled() { - box-shadow: none; - background-color: transparent; - color: transparentize($fg-color, 0.7); + box-shadow: none; + background-color: transparent; + color: transparentize($fg-color, 0.7); } @mixin button($flat: false, $reactive: true, $radii: $radii, $focusable: true) { - @include unset; - transition: $transition; - border-radius: $radii; - color: $fg-color; - - @if $flat { - background-color: transparent; - background-image: none; - box-shadow: none; - } @else { - background-color: $widget-bg; - box-shadow: inset 0 0 0 $border-width $border-color; - } - - @if $reactive { - @if $focusable { - &:focus { - @include button-focus; - } - } - - &:hover { - @include button-hover; - } - - &:active, - &.on, - &.active, - &:checked { - @include button-active; - - &:hover { - box-shadow: - inset 0 0 0 $border-width $border-color, - inset 0 0 0 99px $hover; - } - } - } - - &:disabled { - @include button-disabled; - } + @include unset; + transition: $transition; + border-radius: $radii; + color: $fg-color; + + @if $flat { + background-color: transparent; + background-image: none; + box-shadow: none; + } @else { + background-color: $widget-bg; + box-shadow: inset 0 0 0 $border-width $border-color; + } + + @if $reactive { + @if $focusable { + &:focus { + @include button-focus; + } + } + + &:hover { + @include button-hover; + } + + &:active, + &.on, + &.active, + &:checked { + @include button-active; + + &:hover { + box-shadow: + inset 0 0 0 $border-width $border-color, + inset 0 0 0 99px $hover; + } + } + } + + &:disabled { + @include button-disabled; + } } @mixin accs-button($flat: false, $reactive: true) { - @include button($flat: true, $reactive: false, $focusable: false); - color: $fg-color; - - > * { - border-radius: $radii; - transition: $transition; - - @if $flat { - background-color: transparent; - box-shadow: none; - } @else { - background-color: $widget-bg; - box-shadow: inset 0 0 0 $border-width $border-color; - } - } - - @if $reactive { - &:focus > *, - &.focused > * { - @include button-focus; - } - - &:hover > * { - @include button-hover; - } - - &:active, - &.active, - &.on, - &:checked { - > * { - @include button-active; - } - - &:hover > * { - box-shadow: - inset 0 0 0 $border-width $border-color, - inset 0 0 0 99px $hover; - } - } - } + @include button($flat: true, $reactive: false, $focusable: false); + color: $fg-color; + + > * { + border-radius: $radii; + transition: $transition; + + @if $flat { + background-color: transparent; + box-shadow: none; + } @else { + background-color: $widget-bg; + box-shadow: inset 0 0 0 $border-width $border-color; + } + } + + @if $reactive { + &:focus > *, + &.focused > * { + @include button-focus; + } + + &:hover > * { + @include button-hover; + } + + &:active, + &.active, + &.on, + &:checked { + > * { + @include button-active; + } + + &:hover > * { + box-shadow: + inset 0 0 0 $border-width $border-color, + inset 0 0 0 99px $hover; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/floating-widget.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/floating-widget.scss index fb6f16e6..5f890d8b 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/floating-widget.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/floating-widget.scss @@ -1,13 +1,13 @@ @mixin floating-widget { - @if $drop-shadow { - box-shadow: 0 0 5px 0 $shadow; - } + @if $drop-shadow { + box-shadow: 0 0 5px 0 $shadow; + } - transition: $transition; - margin: max($padding, 8px); - border: $border-width solid $popover-border-color; - background-color: $bg-color; - color: $fg-color; - border-radius: $radii; - padding: $popover-padding; + transition: $transition; + margin: max($padding, 8px); + border: $border-width solid $popover-border-color; + background-color: $bg-color; + color: $fg-color; + border-radius: $radii; + padding: $popover-padding; } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/hidden.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/hidden.scss index fa37085b..fc0f404d 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/hidden.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/hidden.scss @@ -1,15 +1,15 @@ @mixin hidden { - background-color: transparent; - background-image: none; - border-color: transparent; - box-shadow: none; - -gtk-icon-transform: scale(0); + background-color: transparent; + background-image: none; + border-color: transparent; + box-shadow: none; + -gtk-icon-transform: scale(0); - * { - background-color: transparent; - background-image: none; - border-color: transparent; - box-shadow: none; - -gtk-icon-transform: scale(0); - } + * { + background-color: transparent; + background-image: none; + border-color: transparent; + box-shadow: none; + -gtk-icon-transform: scale(0); + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/menu.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/menu.scss index 5cbae1e2..a3b1874f 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/menu.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/menu.scss @@ -1,31 +1,31 @@ window.popup { - > * { - border: none; - box-shadow: none; - } + > * { + border: none; + box-shadow: none; + } - menu { - border-radius: $popover-radius; - background-color: $bg-color; - padding: $popover-padding; - border: $border-width solid $popover-border-color; + menu { + border-radius: $popover-radius; + background-color: $bg-color; + padding: $popover-padding; + border: $border-width solid $popover-border-color; - separator { - background-color: $border-color; - } + separator { + background-color: $border-color; + } - menuitem { - @include button; - padding: $spacing/2; - margin: $spacing/2 0; + menuitem { + @include button; + padding: $spacing/2; + margin: $spacing/2 0; - &:first-child { - margin-top: 0; - } + &:first-child { + margin-top: 0; + } - &:last-child { - margin-bottom: 0; - } - } - } + &:last-child { + margin-bottom: 0; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/scrollable.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/scrollable.scss index 9386cd9f..35be0c85 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/scrollable.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/scrollable.scss @@ -1,28 +1,28 @@ @mixin scrollable { - scrollbar, - scrollbar * { - all: unset; - } + scrollbar, + scrollbar * { + all: unset; + } - scrollbar.vertical { - transition: $transition; - background-color: transparentize($bg-color, 0.7); + scrollbar.vertical { + transition: $transition; + background-color: transparentize($bg-color, 0.7); - &:hover { - background-color: transparentize($bg-color, 0.3); + &:hover { + background-color: transparentize($bg-color, 0.3); - slider { - background-color: transparentize($fg-color, 0.3); - min-width: 0.6em; - } - } - } + slider { + background-color: transparentize($fg-color, 0.3); + min-width: 0.6em; + } + } + } - scrollbar.vertical slider { - background-color: transparentize($fg-color, 0.5); - border-radius: $radii; - min-width: 0.4em; - min-height: 2em; - transition: $transition; - } + scrollbar.vertical slider { + background-color: transparentize($fg-color, 0.5); + border-radius: $radii; + min-width: 0.4em; + min-height: 2em; + transition: $transition; + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/slider.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/slider.scss index 72450e86..fb2bfa53 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/slider.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/slider.scss @@ -1,79 +1,79 @@ @import "./unset"; @mixin slider( - $width: 0.7em, - $slider-width: 0.5em, - $gradient: $active-gradient, - $slider: true, - $focusable: true, - $radii: $radii + $width: 0.7em, + $slider-width: 0.5em, + $gradient: $active-gradient, + $slider: true, + $focusable: true, + $radii: $radii ) { - @include unset($rec: true); + @include unset($rec: true); - trough { - transition: $transition; - border-radius: $radii; - border: $border; - background-color: $widget-bg; - min-height: $width; - min-width: $width; + trough { + transition: $transition; + border-radius: $radii; + border: $border; + background-color: $widget-bg; + min-height: $width; + min-width: $width; - highlight, - progress { - border-radius: max($radii - $border-width, 0); - background-image: $gradient; - min-height: $width; - min-width: $width; - } - } + highlight, + progress { + border-radius: max($radii - $border-width, 0); + background-image: $gradient; + min-height: $width; + min-width: $width; + } + } - slider { - box-shadow: none; - background-color: transparent; - border: $border-width solid transparent; - transition: $transition; - border-radius: $radii; - min-height: $width; - min-width: $width; - margin: -$slider-width; - } + slider { + box-shadow: none; + background-color: transparent; + border: $border-width solid transparent; + transition: $transition; + border-radius: $radii; + min-height: $width; + min-width: $width; + margin: -$slider-width; + } - &:hover { - trough { - background-color: $hover; - } + &:hover { + trough { + background-color: $hover; + } - slider { - @if $slider { - background-color: $fg-color; - border-color: $border-color; + slider { + @if $slider { + background-color: $fg-color; + border-color: $border-color; - @if $drop-shadow { - box-shadow: 0 0 3px 0 $shadow; - } - } - } - } + @if $drop-shadow { + box-shadow: 0 0 3px 0 $shadow; + } + } + } + } - &:disabled { - highlight, - progress { - background-color: transparentize($fg-color, 0.4); - background-image: none; - } - } + &:disabled { + highlight, + progress { + background-color: transparentize($fg-color, 0.4); + background-image: none; + } + } - @if $focusable { - trough:focus { - background-color: $hover; - box-shadow: inset 0 0 0 $border-width $accent; + @if $focusable { + trough:focus { + background-color: $hover; + box-shadow: inset 0 0 0 $border-width $accent; - slider { - @if $slider { - background-color: $fg-color; - box-shadow: inset 0 0 0 $border-width $accent; - } - } - } - } + slider { + @if $slider { + background-color: $fg-color; + box-shadow: inset 0 0 0 $border-width $accent; + } + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/spacing.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/spacing.scss index 1582ae1a..3032e478 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/spacing.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/spacing.scss @@ -1,53 +1,53 @@ @mixin spacing($multiplier: 1, $spacing: $spacing, $rec: false) { - &.horizontal > * { - margin: 0 $spacing * $multiplier / 2; - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - } - - &.vertical > * { - margin: $spacing * $multiplier / 2 0; - - &:first-child { - margin-top: 0; - } - - &:last-child { - margin-bottom: 0; - } - } - - @if $rec { - box { - &.horizontal > * { - margin: 0 $spacing * $multiplier / 2; - - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - } - - &.vertical > * { - margin: $spacing * $multiplier / 2 0; - - &:first-child { - margin-top: 0; - } - - &:last-child { - margin-bottom: 0; - } - } - } - } + &.horizontal > * { + margin: 0 $spacing * $multiplier / 2; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &.vertical > * { + margin: $spacing * $multiplier / 2 0; + + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } + } + + @if $rec { + box { + &.horizontal > * { + margin: 0 $spacing * $multiplier / 2; + + &:first-child { + margin-left: 0; + } + + &:last-child { + margin-right: 0; + } + } + + &.vertical > * { + margin: $spacing * $multiplier / 2 0; + + &:first-child { + margin-top: 0; + } + + &:last-child { + margin-bottom: 0; + } + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/switch.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/switch.scss index 15425082..cac46a31 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/switch.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/switch.scss @@ -1,16 +1,16 @@ @import "./button"; @mixin switch { - @include button; + @include button; - slider { - background-color: $fg-color; - border-radius: $radii; - min-width: 24px; - min-height: 24px; - } + slider { + background-color: $fg-color; + border-radius: $radii; + min-width: 24px; + min-height: 24px; + } - image { - color: transparent; - } + image { + color: transparent; + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/text-border.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/text-border.scss index 2d06bda4..fbfd1565 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/text-border.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/text-border.scss @@ -1,13 +1,13 @@ @mixin text-border { - text-shadow: - -1 * $border-width -1 * $border-width 0 $border-color, - $border-width $border-width 0 $border-color, - -1 * $border-width $border-width 0 $border-color, - $border-width -1 * $border-width 0 $border-color; + text-shadow: + -1 * $border-width -1 * $border-width 0 $border-color, + $border-width $border-width 0 $border-color, + -1 * $border-width $border-width 0 $border-color, + $border-width -1 * $border-width 0 $border-color; - -gtk-icon-shadow: - -1 * $border-width -1 * $border-width 0 $border-color, - $border-width $border-width 0 $border-color, - -1 * $border-width $border-width 0 $border-color, - $border-width -1 * $border-width 0 $border-color; + -gtk-icon-shadow: + -1 * $border-width -1 * $border-width 0 $border-color, + $border-width $border-width 0 $border-color, + -1 * $border-width $border-width 0 $border-color, + $border-width -1 * $border-width 0 $border-color; } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/tooltip.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/tooltip.scss index ca6179ee..b19aff25 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/tooltip.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/tooltip.scss @@ -1,18 +1,18 @@ tooltip { - * { - all: unset; - } + * { + all: unset; + } - background-color: transparent; - border: none; + background-color: transparent; + border: none; - > * > * { - background-color: $bg-color; - border-radius: $radii; - border: $border-width solid $popover-border-color; - color: $fg-color; - padding: 8px; - margin: 4px; - box-shadow: 0 0 3px 0 $shadow; - } + > * > * { + background-color: $bg-color; + border-radius: $radii; + border: $border-width solid $popover-border-color; + color: $fg-color; + padding: 8px; + margin: 4px; + box-shadow: 0 0 3px 0 $shadow; + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/unset.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/unset.scss index 026d4e1c..1dce6207 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/unset.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/unset.scss @@ -1,9 +1,9 @@ @mixin unset($rec: false) { - all: unset; + all: unset; - @if $rec { - * { - all: unset; - } - } + @if $rec { + * { + all: unset; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/widget.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/widget.scss index b2c3e577..b3d96948 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/common/widget.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/common/widget.scss @@ -1,7 +1,7 @@ @mixin widget { - transition: $transition; - border-radius: $radii; - color: $fg-color; - background-color: $widget-bg; - border: $border; + transition: $transition; + border-radius: $radii; + color: $fg-color; + background-color: $widget-bg; + border: $border; } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/variables.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/variables.scss index 05a7bfc7..b4ef1071 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/variables.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/variables.scss @@ -3,9 +3,9 @@ $widget-bg: transparentize($_widget-bg, $widget-opacity / 100); $active-gradient: linear-gradient($accent-gradient); $hover-fg: if( - $color-scheme == "dark", - lighten($fg-color, 10%), - darken($fg-color, 8%) + $color-scheme == "dark", + lighten($fg-color, 10%), + darken($fg-color, 8%) ); $border_color: transparentize($_border_color, $border_opacity / 100); @@ -14,8 +14,8 @@ $border: $border-width solid $border-color; $text-shadow: 2px 2px 2px $shadow; $popover-border-color: transparentize( - $_border-color, - max(($border-opacity - 1) / 100, 0) + $_border-color, + max(($border-opacity - 1) / 100, 0) ); $popover-padding: $padding * $popover-padding-multiplier; $popover-radius: if($radii ==0, 0, $radii + $popover-padding); @@ -23,5 +23,5 @@ $popover-radius: if($radii ==0, 0, $radii + $popover-padding); $shader-fg: #fff; * { - font-size: $font-size; + font-size: $font-size; } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/applauncher.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/applauncher.scss index a26e2d08..7b207d8b 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/applauncher.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/applauncher.scss @@ -1,73 +1,73 @@ window#applauncher .window-content { - @include floating_widget; + @include floating_widget; - entry { - @include button; - padding: $padding; - margin-bottom: $spacing; + entry { + @include button; + padding: $padding; + margin-bottom: $spacing; - label, - image { - color: $fg-color; - } - } + label, + image { + color: $fg-color; + } + } - separator { - min-height: 1px; - background-color: $hover; - } + separator { + min-height: 1px; + background-color: $hover; + } - scrolledwindow { - @include scrollable; - min-width: $applauncher-width; - min-height: $applauncher-height; - } + scrolledwindow { + @include scrollable; + min-width: $applauncher-width; + min-height: $applauncher-height; + } - button.app-item { - @include button($flat: true, $reactive: false); + button.app-item { + @include button($flat: true, $reactive: false); - > box { - @include spacing(0.5); - } + > box { + @include spacing(0.5); + } - transition: $transition; - padding: $padding; + transition: $transition; + padding: $padding; - label { - transition: $transition; + label { + transition: $transition; - &.title { - color: $fg-color; - } + &.title { + color: $fg-color; + } - &.description { - color: transparentize($fg-color, 0.3); - } - } + &.description { + color: transparentize($fg-color, 0.3); + } + } - image { - transition: $transition; - } + image { + transition: $transition; + } - &:hover, - &:focus { - .title { - color: $accent; - } + &:hover, + &:focus { + .title { + color: $accent; + } - image { - -gtk-icon-shadow: 2px 2px $accent; - } - } + image { + -gtk-icon-shadow: 2px 2px $accent; + } + } - &:active { - background-color: transparentize($accent, 0.5); - border-radius: $radii; - box-shadow: inset 0 0 0 $border-width $border-color; + &:active { + background-color: transparentize($accent, 0.5); + border-radius: $radii; + box-shadow: inset 0 0 0 $border-width $border-color; - .title { - color: $fg-color; - } - } - } + .title { + color: $fg-color; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/bar.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/bar.scss index 8c8ec79e..a0139f60 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/bar.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/bar.scss @@ -1,276 +1,276 @@ $bar-spacing: $spacing / 1.5; $button-radius: if( - $bar-style == "floating", - max(0, $radii - $bar-spacing), - $radii + $bar-style == "floating", + max(0, $radii - $bar-spacing), + $radii ); @mixin panel-button($flat: $bar-flat-buttons, $reactive: true) { - @include unset; - - @if $bar-style == "separated" { - transition: $transition; - - > * { - @include floating-widget; - border-radius: $radii; - margin: $wm-gaps $bar-spacing; - transition: $transition; - } - - &:hover > * { - color: $hover-fg; - - @if $drop-shadow { - box-shadow: - 0 0 min(6px, $spacing/2) 0 $shadow, - inset 0 0 0 99px $hover; - } @else { - box-shadow: inset 0 0 0 99px $hover; - } - } - - &:active > *, - &.active > * { - label, - image { - color: $accent-fg; - } - - background-image: $active-gradient; - background-color: $accent; - } - } @else { - @include accs-button($flat, $reactive); - - > * { - margin: $bar-spacing; - border-radius: $button-radius; - } - } - - label, - image { - font-weight: bold; - } - - > * { - padding: $padding * 0.4 $padding * 0.7; - } + @include unset; + + @if $bar-style == "separated" { + transition: $transition; + + > * { + @include floating-widget; + border-radius: $radii; + margin: $wm-gaps $bar-spacing; + transition: $transition; + } + + &:hover > * { + color: $hover-fg; + + @if $drop-shadow { + box-shadow: + 0 0 min(6px, $spacing/2) 0 $shadow, + inset 0 0 0 99px $hover; + } @else { + box-shadow: inset 0 0 0 99px $hover; + } + } + + &:active > *, + &.active > * { + label, + image { + color: $accent-fg; + } + + background-image: $active-gradient; + background-color: $accent; + } + } @else { + @include accs-button($flat, $reactive); + + > * { + margin: $bar-spacing; + border-radius: $button-radius; + } + } + + label, + image { + font-weight: bold; + } + + > * { + padding: $padding * 0.4 $padding * 0.7; + } } .panel { - @if $bar-style == "normal" { - background-color: $bg-color; - } - - @if $bar-style == "normal" { - @if $bar-position == "bottom" { - border-top: $border; - } @else { - border-bottom: $border; - } - } - - @if $bar-style == "floating" { - @include floating-widget; - border-radius: $radii; - margin: $wm-gaps; - padding: 0; - } - - @if $bar-style == "separated" { - > .end > button:last-child > * { - margin-right: $wm-gaps; - } - - > .start > button:first-child > * { - margin-left: $wm-gaps; - } - } - - .panel-button { - @include panel-button; - } - - .tray-item, - .color-picker { - @include panel-button($flat: true); - } - - separator { - background-color: transparentize($fg-color, 0.86); - border-radius: $radii; - min-height: 5px; - min-width: 5px; - } - - .overview { - label { - color: transparentize($accent, 0.2); - } - - &:hover label { - color: $accent; - } - - &:active label, - &.active label { - color: $accent-fg; - } - } - - .powermenu, - .recorder { - image { - color: transparentize($red, 0.3); - } - - &:hover image { - color: transparentize($red, 0.15); - } - - &:active image { - color: $red; - } - } - - .focused-client > box > box, - .quicksettings > box { - @include spacing(1, if($bar-spacing ==0, $padding / 2, $bar-spacing)); - } - - /* stylelint-disable-next-line selector-not-notation */ - .quicksettings:not(.active):not(:active) { - .bluetooth { - color: $blue; - } - - .battery { - &.low { - color: $red; - } - - &.charged, - &.charging { - color: $green; - } - } - } - - .media { - &.spotify image { - color: $green; - } - - &.firefox image { - color: $orange; - } - - &.mpv image { - color: $magenta; - } - } - - .notifications { - image { - color: $yellow; - } - } - - .battery-bar { - .font-icon { - font-size: 1.3em; - } - - image, - .font-icon { - margin-right: $bar-spacing * 0.5; - } - - levelbar trough { - @include widget; - min-width: $battery-bar-width; - min-height: $battery-bar-height; - - block.filled { - border-radius: max($radii - $border-width, 0); - background-image: $active-gradient; - } - } - - @mixin color($color) { - image, - label { - color: $color; - } - - block.filled { - background-image: linear-gradient( - to right, - $color, - lighten($color, 6%) - ); - } - } - - .medium { - @include color($yellow); - } - - .low { - @include color($red); - } - - .charging { - @include color($green); - } - - &:active { - @include color($accent-fg); - } - } - - .workspaces button { - all: unset; - - .indicator { - font-size: 0; - min-width: 8px; - min-height: 8px; - border-radius: $radii * 0.6; - box-shadow: inset 0 0 0 $border-width $border-color; - margin: 0 $padding/2; - transition: $transition/2; - background-color: transparentize($fg-color, 0.8); - } - - &:last-child .indicator { - margin-right: $padding; - } - - &:first-child .indicator { - margin-left: $padding; - } - - &.occupied .indicator { - background-color: transparentize($fg-color, 0.2); - min-width: 10px; - min-height: 10px; - } - - &:hover .indicator { - box-shadow: inset 0 0 0 10px transparentize($fg-color, 0.8); - } - - &.active .indicator, - &:active .indicator { - background-color: $accent; - } - - &.active .indicator { - min-width: 24px; - min-height: 16px; - } - } + @if $bar-style == "normal" { + background-color: $bg-color; + } + + @if $bar-style == "normal" { + @if $bar-position == "bottom" { + border-top: $border; + } @else { + border-bottom: $border; + } + } + + @if $bar-style == "floating" { + @include floating-widget; + border-radius: $radii; + margin: $wm-gaps; + padding: 0; + } + + @if $bar-style == "separated" { + > .end > button:last-child > * { + margin-right: $wm-gaps; + } + + > .start > button:first-child > * { + margin-left: $wm-gaps; + } + } + + .panel-button { + @include panel-button; + } + + .tray-item, + .color-picker { + @include panel-button($flat: true); + } + + separator { + background-color: transparentize($fg-color, 0.86); + border-radius: $radii; + min-height: 5px; + min-width: 5px; + } + + .overview { + label { + color: transparentize($accent, 0.2); + } + + &:hover label { + color: $accent; + } + + &:active label, + &.active label { + color: $accent-fg; + } + } + + .powermenu, + .recorder { + image { + color: transparentize($red, 0.3); + } + + &:hover image { + color: transparentize($red, 0.15); + } + + &:active image { + color: $red; + } + } + + .focused-client > box > box, + .quicksettings > box { + @include spacing(1, if($bar-spacing ==0, $padding / 2, $bar-spacing)); + } + + /* stylelint-disable-next-line selector-not-notation */ + .quicksettings:not(.active):not(:active) { + .bluetooth { + color: $blue; + } + + .battery { + &.low { + color: $red; + } + + &.charged, + &.charging { + color: $green; + } + } + } + + .media { + &.spotify image { + color: $green; + } + + &.firefox image { + color: $orange; + } + + &.mpv image { + color: $magenta; + } + } + + .notifications { + image { + color: $yellow; + } + } + + .battery-bar { + .font-icon { + font-size: 1.3em; + } + + image, + .font-icon { + margin-right: $bar-spacing * 0.5; + } + + levelbar trough { + @include widget; + min-width: $battery-bar-width; + min-height: $battery-bar-height; + + block.filled { + border-radius: max($radii - $border-width, 0); + background-image: $active-gradient; + } + } + + @mixin color($color) { + image, + label { + color: $color; + } + + block.filled { + background-image: linear-gradient( + to right, + $color, + lighten($color, 6%) + ); + } + } + + .medium { + @include color($yellow); + } + + .low { + @include color($red); + } + + .charging { + @include color($green); + } + + &:active { + @include color($accent-fg); + } + } + + .workspaces button { + all: unset; + + .indicator { + font-size: 0; + min-width: 8px; + min-height: 8px; + border-radius: $radii * 0.6; + box-shadow: inset 0 0 0 $border-width $border-color; + margin: 0 $padding/2; + transition: $transition/2; + background-color: transparentize($fg-color, 0.8); + } + + &:last-child .indicator { + margin-right: $padding; + } + + &:first-child .indicator { + margin-left: $padding; + } + + &.occupied .indicator { + background-color: transparentize($fg-color, 0.2); + min-width: 10px; + min-height: 10px; + } + + &:hover .indicator { + box-shadow: inset 0 0 0 10px transparentize($fg-color, 0.8); + } + + &.active .indicator, + &:active .indicator { + background-color: $accent; + } + + &.active .indicator { + min-width: 24px; + min-height: 16px; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/dashboard.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/dashboard.scss index 6a4e478c..03019972 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/dashboard.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/dashboard.scss @@ -1,133 +1,133 @@ @mixin calendar { - @include widget; - padding: $padding * 2 $padding * 2 0; - - calendar { - all: unset; - - &.button { - @include button($flat: true); - } - - &:selected { - box-shadow: - inset 0 -8px 0 0 transparentize($accent, 0.5), - inset 0 0 0 1px $accent; - border-radius: $radii * 0.6; - } - - &.header { - background-color: transparent; - border: none; - color: transparentize($fg-color, 0.5); - } - - &.highlight { - background-color: transparent; - color: transparentize($accent, 0.5); - } - - &:indeterminate { - color: transparentize($fg-color, 0.9); - } - - font-size: 1.1em; - padding: 0.2em; - } + @include widget; + padding: $padding * 2 $padding * 2 0; + + calendar { + all: unset; + + &.button { + @include button($flat: true); + } + + &:selected { + box-shadow: + inset 0 -8px 0 0 transparentize($accent, 0.5), + inset 0 0 0 1px $accent; + border-radius: $radii * 0.6; + } + + &.header { + background-color: transparent; + border: none; + color: transparentize($fg-color, 0.5); + } + + &.highlight { + background-color: transparent; + color: transparentize($accent, 0.5); + } + + &:indeterminate { + color: transparentize($fg-color, 0.9); + } + + font-size: 1.1em; + padding: 0.2em; + } } window#dashboard .window-content { - @include floating-widget; - - .notifications { - min-width: $notifications-width; - - .header { - margin-bottom: $spacing; - margin-right: $spacing; - - > label { - margin-left: $radii / 2; - } - - button { - @include button; - padding: $padding/2 $padding; - } - } - - .notification-scrollable { - @include scrollable; - } - - .notification-list { - margin-right: $spacing; - } - - .notification { - @include notification; - - > box { - @include widget; - padding: $padding; - margin-bottom: $spacing; - } - } - - .placeholder { - image { - font-size: 7em; - } - - label { - font-size: 1.2em; - } - } - } - - separator { - background-color: $popover-border-color; - min-width: 2px; - border-radius: $radii; - margin-right: $spacing; - } - - .datemenu, - .system-info { - @include spacing; - } - - .clock-box { - padding: $padding; - - .clock { - font-size: 5em; - } - - .uptime { - color: transparentize($fg-color, 0.2); - } - } - - .calendar { - @include calendar; - } - - .circular-progress-box { - @include widget; - padding: $padding; - - .circular-progress { - min-height: $sys-info-size; - min-width: $sys-info-size; - margin: $padding/2; - font-size: $padding; - background-color: $bg-color; - color: $accent; - - image { - font-size: 1.8em; - } - } - } + @include floating-widget; + + .notifications { + min-width: $notifications-width; + + .header { + margin-bottom: $spacing; + margin-right: $spacing; + + > label { + margin-left: $radii / 2; + } + + button { + @include button; + padding: $padding/2 $padding; + } + } + + .notification-scrollable { + @include scrollable; + } + + .notification-list { + margin-right: $spacing; + } + + .notification { + @include notification; + + > box { + @include widget; + padding: $padding; + margin-bottom: $spacing; + } + } + + .placeholder { + image { + font-size: 7em; + } + + label { + font-size: 1.2em; + } + } + } + + separator { + background-color: $popover-border-color; + min-width: 2px; + border-radius: $radii; + margin-right: $spacing; + } + + .datemenu, + .system-info { + @include spacing; + } + + .clock-box { + padding: $padding; + + .clock { + font-size: 5em; + } + + .uptime { + color: transparentize($fg-color, 0.2); + } + } + + .calendar { + @include calendar; + } + + .circular-progress-box { + @include widget; + padding: $padding; + + .circular-progress { + min-height: $sys-info-size; + min-width: $sys-info-size; + margin: $padding/2; + font-size: $padding; + background-color: $bg-color; + color: $accent; + + image { + font-size: 1.8em; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/desktop.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/desktop.scss index f623ab70..cf753a4f 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/desktop.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/desktop.scss @@ -1,73 +1,73 @@ window.desktop { - @if $bar-style == "normal" { - box-shadow: inset 0 0 $padding 0 $shadow; - } + @if $bar-style == "normal" { + box-shadow: inset 0 0 $padding 0 $shadow; + } - .clock-box-shadow { - border: 5px solid $wallpaper-fg; - border-radius: $radii; + .clock-box-shadow { + border: 5px solid $wallpaper-fg; + border-radius: $radii; - .clock-box { - border-radius: max($radii - 5px, 0); - padding: 0 14px; + .clock-box { + border-radius: max($radii - 5px, 0); + padding: 0 14px; - .clock { - color: $wallpaper-fg; - font-size: 140px; - font-family: $mono-font; - } + .clock { + color: $wallpaper-fg; + font-size: 140px; + font-family: $mono-font; + } - .separator-box { - padding: 24px 12px; + .separator-box { + padding: 24px 12px; - separator { - border-radius: $radii; - min-width: 16px; - min-height: 16px; - background-color: $wallpaper-fg; - } - } - } - } + separator { + border-radius: $radii; + min-width: 16px; + min-height: 16px; + background-color: $wallpaper-fg; + } + } + } + } - .date { - color: $wallpaper-fg; - font-size: 48px; - } + .date { + color: $wallpaper-fg; + font-size: 48px; + } - @if $drop-shadow { - .clock-box-shadow, - separator { - box-shadow: 2px 2px 2px 0 $shadow; - } + @if $drop-shadow { + .clock-box-shadow, + separator { + box-shadow: 2px 2px 2px 0 $shadow; + } - .clock-box { - box-shadow: inset 2px 2px 2px 0 $shadow; - } + .clock-box { + box-shadow: inset 2px 2px 2px 0 $shadow; + } - label { - text-shadow: $text-shadow; - } - } @else { - .clock-box-shadow { - box-shadow: - 0 0 0 $border-width $border-color, - inset 0 0 0 $border-width $border-color; - } + label { + text-shadow: $text-shadow; + } + } @else { + .clock-box-shadow { + box-shadow: + 0 0 0 $border-width $border-color, + inset 0 0 0 $border-width $border-color; + } - separator { - border: $border; - } + separator { + border: $border; + } - label { - @include text-border; - } - } + label { + @include text-border; + } + } } .desktop-menu { - image { - margin-left: -14px; - margin-right: 6px; - } + image { + margin-left: -14px; + margin-right: 6px; + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/media.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/media.scss index c4010296..f47bca81 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/media.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/media.scss @@ -1,122 +1,122 @@ @mixin player-color($color) { - button { - .shuffle.enabled { - color: $color; - } - - .loop { - &.playlist, - &.track { - color: $color; - } - } - - &:active label { - color: $color; - } - } - - .position-slider:hover trough { - background-color: transparentize($color, 0.5); - } - - .player-icon { - color: $color; - } + button { + .shuffle.enabled { + color: $color; + } + + .loop { + &.playlist, + &.track { + color: $color; + } + } + + &:active label { + color: $color; + } + } + + .position-slider:hover trough { + background-color: transparentize($color, 0.5); + } + + .player-icon { + color: $color; + } } @mixin media() { - @include widget; - - label { - color: $shader-fg; - text-shadow: $text-shadow; - } - - .blurred-cover, - .cover { - background-size: cover; - background-position: center; - border-radius: $radii * 0.8; - opacity: 0.8; - } - - .cover { - min-height: 100px; - min-width: 100px; - box-shadow: 2px 2px 2px 0 $shadow; - margin: $padding; - opacity: 0.9; - } - - .labels { - margin-top: $padding; - - label { - font-size: 1.1em; - text-shadow: $text-shadow; - - &.title { - font-weight: bold; - } - } - } - - .position-slider { - @include slider( - $width: 0.4em, - $slider: false, - $gradient: linear-gradient($shader-fg, $shader-fg), - $radii: 0 - ); - margin-bottom: $padding/2; - - trough { - border: none; - background-color: transparentize($shader-fg, 0.7); - } - } - - .footer-box { - margin: -$padding/2 $padding $padding/2; - - image { - -gtk-icon-shadow: $text-shadow; - } - } - - .controls button { - @include unset; - - label { - font-size: 2em; - color: transparentize($shader-fg, 0.2); - transition: $transition; - - &.shuffle, - &.loop { - font-size: 1.4em; - } - } - - &:hover label { - color: transparentize($shader-fg, 0.1); - } - - &:active label { - color: $shader-fg; - } - } - - &.spotify { - @include player-color($green); - } - - &.firefox { - @include player-color($orange); - } - - &.mpv { - @include player-color($magenta); - } + @include widget; + + label { + color: $shader-fg; + text-shadow: $text-shadow; + } + + .blurred-cover, + .cover { + background-size: cover; + background-position: center; + border-radius: $radii * 0.8; + opacity: 0.8; + } + + .cover { + min-height: 100px; + min-width: 100px; + box-shadow: 2px 2px 2px 0 $shadow; + margin: $padding; + opacity: 0.9; + } + + .labels { + margin-top: $padding; + + label { + font-size: 1.1em; + text-shadow: $text-shadow; + + &.title { + font-weight: bold; + } + } + } + + .position-slider { + @include slider( + $width: 0.4em, + $slider: false, + $gradient: linear-gradient($shader-fg, $shader-fg), + $radii: 0 + ); + margin-bottom: $padding/2; + + trough { + border: none; + background-color: transparentize($shader-fg, 0.7); + } + } + + .footer-box { + margin: -$padding/2 $padding $padding/2; + + image { + -gtk-icon-shadow: $text-shadow; + } + } + + .controls button { + @include unset; + + label { + font-size: 2em; + color: transparentize($shader-fg, 0.2); + transition: $transition; + + &.shuffle, + &.loop { + font-size: 1.4em; + } + } + + &:hover label { + color: transparentize($shader-fg, 0.1); + } + + &:active label { + color: $shader-fg; + } + } + + &.spotify { + @include player-color($green); + } + + &.firefox { + @include player-color($orange); + } + + &.mpv { + @include player-color($magenta); + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/notifications.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/notifications.scss index cce6e832..7372cf26 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/notifications.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/notifications.scss @@ -1,81 +1,81 @@ @mixin notification() { - &.critical > box { - box-shadow: inset 0 0 0.5em 0 $red; - } + &.critical > box { + box-shadow: inset 0 0 0.5em 0 $red; + } - &:hover button.close-button { - @include button-hover; - background-color: transparentize($red, 0.5); - } + &:hover button.close-button { + @include button-hover; + background-color: transparentize($red, 0.5); + } - .content { - .title { - margin-right: $spacing; - color: $fg-color; - font-size: 1.1em; - } + .content { + .title { + margin-right: $spacing; + color: $fg-color; + font-size: 1.1em; + } - .time { - color: transparentize($fg-color, 0.2); - } + .time { + color: transparentize($fg-color, 0.2); + } - .description { - font-size: 0.9em; - color: transparentize($fg-color, 0.2); - } + .description { + font-size: 0.9em; + color: transparentize($fg-color, 0.2); + } - .icon { - border-radius: $radii * 0.8; - margin-right: $spacing; + .icon { + border-radius: $radii * 0.8; + margin-right: $spacing; - &.img { - border: $border; - } - } - } + &.img { + border: $border; + } + } + } - box.actions { - @include spacing(0.5); - margin-top: $spacing; + box.actions { + @include spacing(0.5); + margin-top: $spacing; - button { - @include button; - border-radius: $radii * 0.8; - font-size: 1.2em; - padding: $padding * 0.7; - } - } + button { + @include button; + border-radius: $radii * 0.8; + font-size: 1.2em; + padding: $padding * 0.7; + } + } - button.close-button { - @include button($flat: true); - margin-left: $spacing / 2; - border-radius: $radii * 0.8; - min-width: 1.2em; - min-height: 1.2em; + button.close-button { + @include button($flat: true); + margin-left: $spacing / 2; + border-radius: $radii * 0.8; + min-width: 1.2em; + min-height: 1.2em; - &:hover { - background-color: transparentize($red, 0.2); - } + &:hover { + background-color: transparentize($red, 0.2); + } - &:active { - background-image: linear-gradient($red, $red); - } - } + &:active { + background-image: linear-gradient($red, $red); + } + } } window.notifications { - @include unset; + @include unset; - .notification { - @include notification; + .notification { + @include notification; - > box { - @include floating-widget; - border-radius: $radii; - } + > box { + @include floating-widget; + border-radius: $radii; + } - .description { - min-width: 350px; - } - } + .description { + min-width: 350px; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/osd.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/osd.scss index c0054c26..aaa32f42 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/osd.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/osd.scss @@ -1,19 +1,19 @@ window.indicator .progress { - @include floating-widget; - padding: $padding / 2; - border-radius: if($radii ==0, 0, $radii + $padding / 2); + @include floating-widget; + padding: $padding / 2; + border-radius: if($radii ==0, 0, $radii + $padding / 2); - .fill { - border-radius: $radii; - background-color: $accent; - color: $accent-fg; + .fill { + border-radius: $radii; + background-color: $accent; + color: $accent-fg; - image { - -gtk-icon-transform: scale(0.7); - } + image { + -gtk-icon-transform: scale(0.7); + } - .font-icon { - font-size: 34px; - } - } + .font-icon { + font-size: 34px; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/powermenu.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/powermenu.scss index 1851dd56..e02e61c5 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/powermenu.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/powermenu.scss @@ -1,58 +1,58 @@ window#powermenu { - .shader { - background-color: rgba(0, 0, 0, 0.05); - } + .shader { + background-color: rgba(0, 0, 0, 0.05); + } } window#powermenu .window-content { - @include floating-widget; - @include spacing(2); - padding: $popover-padding + $spacing * 1.5; - border-radius: if( - $radii ==0, - 0, - $popover-radius + ($popover-padding + $spacing * 1.5) - ); - - button { - @include unset; - - image { - @include button; - border-radius: $popover-radius; - min-width: 1.7em; - min-height: 1.7em; - font-size: 4em; - } - - label, - image { - color: transparentize($fg-color, 0.1); - } - - &:hover { - image { - @include button-hover; - } - - label { - color: $fg-color; - } - } - - &:focus image { - @include button-focus; - } - - &:active image { - @include button-active; - } - - &:focus, - &:active { - label { - color: $accent; - } - } - } + @include floating-widget; + @include spacing(2); + padding: $popover-padding + $spacing * 1.5; + border-radius: if( + $radii ==0, + 0, + $popover-radius + ($popover-padding + $spacing * 1.5) + ); + + button { + @include unset; + + image { + @include button; + border-radius: $popover-radius; + min-width: 1.7em; + min-height: 1.7em; + font-size: 4em; + } + + label, + image { + color: transparentize($fg-color, 0.1); + } + + &:hover { + image { + @include button-hover; + } + + label { + color: $fg-color; + } + } + + &:focus image { + @include button-focus; + } + + &:active image { + @include button-active; + } + + &:focus, + &:active { + label { + color: $accent; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/quicksettings.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/quicksettings.scss index b46ce0e5..64809002 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/quicksettings.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/quicksettings.scss @@ -1,167 +1,167 @@ window#quicksettings .window-content { - @include floating-widget; - @include spacing; - - .avatar { - @include widget; - } - - .header { - @include spacing; - } - - .system-box { - @include widget; - @include spacing($rec: true); - - padding: $padding; - - button, - .uptime { - @include button; - padding: $padding; - font-weight: bold; - min-height: 20px; - min-width: 20px; - - image { - font-size: 1.2em; - } - } - } - - .battery-progress { - label { - color: $accent-fg; - font-weight: bold; - } - - &.charging label { - font-size: $padding * 2; - } - - &.half label { - color: $fg-color; - } - - progressbar { - @include slider($width: $padding * 3.6); - } - - &.low progressbar { - @include slider( - $width: $padding * 3.6, - $gradient: linear-gradient(to right, $red, $red) - ); - } - } - - .sliders-box { - @include widget; - @include spacing($rec: true); - @include spacing(0); - padding: $padding; - - button { - @include button($flat: true); - padding: $padding / 2; - } - - scale { - @include slider; - margin-left: $spacing * -0.5; - } - - .menu { - margin: $spacing 0; - background-color: $bg-color; - border: $border-width solid $popover-border-color; - border-radius: $radii; - } - } - - .mixer-item { - scale { - @include slider($width: 7px); - } - - image { - font-size: 1.2em; - } - } - - .row { - @include spacing($rec: true); - } - - .menu { - @include unset; - @include widget; - @include spacing($rec: true); - padding: $padding; - margin-top: $spacing; - - .title { - @include spacing(0.5); - } - - separator { - margin: 0 $radii / 2; - } - - button { - @include button($flat: true); - padding: $padding / 2; - } - - switch { - @include switch; - } - } - - .toggle-button { - @include button; - font-weight: bold; - - .label-box { - @include spacing(0.5); - } - - button { - @include button($flat: true); - padding: $padding; - - &:first-child { - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - - &:last-child { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - } - - &.active { - background-color: $accent; - - label, - image { - color: $accent-fg; - } - } - } - - .simple-toggle { - @include button; - padding: $padding; - } - - .media { - @include spacing; - - .player { - @include media; - } - } + @include floating-widget; + @include spacing; + + .avatar { + @include widget; + } + + .header { + @include spacing; + } + + .system-box { + @include widget; + @include spacing($rec: true); + + padding: $padding; + + button, + .uptime { + @include button; + padding: $padding; + font-weight: bold; + min-height: 20px; + min-width: 20px; + + image { + font-size: 1.2em; + } + } + } + + .battery-progress { + label { + color: $accent-fg; + font-weight: bold; + } + + &.charging label { + font-size: $padding * 2; + } + + &.half label { + color: $fg-color; + } + + progressbar { + @include slider($width: $padding * 3.6); + } + + &.low progressbar { + @include slider( + $width: $padding * 3.6, + $gradient: linear-gradient(to right, $red, $red) + ); + } + } + + .sliders-box { + @include widget; + @include spacing($rec: true); + @include spacing(0); + padding: $padding; + + button { + @include button($flat: true); + padding: $padding / 2; + } + + scale { + @include slider; + margin-left: $spacing * -0.5; + } + + .menu { + margin: $spacing 0; + background-color: $bg-color; + border: $border-width solid $popover-border-color; + border-radius: $radii; + } + } + + .mixer-item { + scale { + @include slider($width: 7px); + } + + image { + font-size: 1.2em; + } + } + + .row { + @include spacing($rec: true); + } + + .menu { + @include unset; + @include widget; + @include spacing($rec: true); + padding: $padding; + margin-top: $spacing; + + .title { + @include spacing(0.5); + } + + separator { + margin: 0 $radii / 2; + } + + button { + @include button($flat: true); + padding: $padding / 2; + } + + switch { + @include switch; + } + } + + .toggle-button { + @include button; + font-weight: bold; + + .label-box { + @include spacing(0.5); + } + + button { + @include button($flat: true); + padding: $padding; + + &:first-child { + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + + &:last-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + } + } + + &.active { + background-color: $accent; + + label, + image { + color: $accent-fg; + } + } + } + + .simple-toggle { + @include button; + padding: $padding; + } + + .media { + @include spacing; + + .player { + @include media; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/settings.scss b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/settings.scss index 7f6823e1..3e8236b7 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/settings.scss +++ b/home/isabel/programs/configs/gui/bars/ags/config/scss/widgets/settings.scss @@ -1,143 +1,143 @@ window#settings-dialog { - background-color: $bg-color; - - .page { - @include scrollable; - } - - .page-content { - margin: $spacing; - } - - .sidebar-box { - @include spacing($rec: true); - background-color: $widget-bg; - border-right: $border; - padding: $spacing / 2; - - button { - @include button($flat: true); - padding: $padding / 2 $padding * 2; - } - - scrolledwindow { - @include scrollable; - } - } - - .sidebar-header { - background-color: $widget-bg; - border-right: $border; - border-bottom: $border; - padding: $spacing / 2; - - button { - @include button($flat: true); - padding: $padding / 2 $padding; - } - - button:last-child { - margin-left: $spacing / 2; - } - } - - .sidebar-footer { - background-color: $widget-bg; - border-right: $border; - border-top: $border; - padding: $spacing / 2; - - button { - @include button($flat: true); - padding: $padding / 2 $padding; - } - } - - entry.search { - @include button; - border-radius: 0; - padding: $padding; - } - - .row { - @include widget; - border-radius: 0; - border-bottom-width: 0; - padding: $padding; - transition: border-radius 0; - - &:last-child { - border-radius: 0 0 $radii $radii; - border-bottom-width: $border-width; - } - - &:first-child { - border-radius: $radii $radii 0 0; - } - - &:first-child:last-child { - border-radius: $radii; - } - - .overlay-padding { - min-height: $font-size * 3; - } - - &:hover { - background-color: $hover; - } - - entry, - button { - @include button; - padding: $padding; - } - - switch { - @include switch; - } - - spinbutton { - @include unset; - - entry { - border-radius: $radii 0 0 $radii; - } - - button { - border-radius: 0; - } - - button:last-child { - border-radius: 0 $radii $radii 0; - } - } - - .enum-setter { - label { - background-color: $widget-bg; - border-top: $border; - border-bottom: $border; - padding: 0 $padding; - } - - button:first-child { - border-radius: $radii 0 0 $radii; - } - - button:last-child { - border-radius: 0 $radii $radii 0; - } - } - } - - .id, - .note { - font-size: 0.8em; - color: transparentize($fg-color, $amount: 0.5); - } - - .id { - font-family: $mono-font; - } + background-color: $bg-color; + + .page { + @include scrollable; + } + + .page-content { + margin: $spacing; + } + + .sidebar-box { + @include spacing($rec: true); + background-color: $widget-bg; + border-right: $border; + padding: $spacing / 2; + + button { + @include button($flat: true); + padding: $padding / 2 $padding * 2; + } + + scrolledwindow { + @include scrollable; + } + } + + .sidebar-header { + background-color: $widget-bg; + border-right: $border; + border-bottom: $border; + padding: $spacing / 2; + + button { + @include button($flat: true); + padding: $padding / 2 $padding; + } + + button:last-child { + margin-left: $spacing / 2; + } + } + + .sidebar-footer { + background-color: $widget-bg; + border-right: $border; + border-top: $border; + padding: $spacing / 2; + + button { + @include button($flat: true); + padding: $padding / 2 $padding; + } + } + + entry.search { + @include button; + border-radius: 0; + padding: $padding; + } + + .row { + @include widget; + border-radius: 0; + border-bottom-width: 0; + padding: $padding; + transition: border-radius 0; + + &:last-child { + border-radius: 0 0 $radii $radii; + border-bottom-width: $border-width; + } + + &:first-child { + border-radius: $radii $radii 0 0; + } + + &:first-child:last-child { + border-radius: $radii; + } + + .overlay-padding { + min-height: $font-size * 3; + } + + &:hover { + background-color: $hover; + } + + entry, + button { + @include button; + padding: $padding; + } + + switch { + @include switch; + } + + spinbutton { + @include unset; + + entry { + border-radius: $radii 0 0 $radii; + } + + button { + border-radius: 0; + } + + button:last-child { + border-radius: 0 $radii $radii 0; + } + } + + .enum-setter { + label { + background-color: $widget-bg; + border-top: $border; + border-bottom: $border; + padding: 0 $padding; + } + + button:first-child { + border-radius: $radii 0 0 $radii; + } + + button:last-child { + border-radius: 0 $radii $radii 0; + } + } + } + + .id, + .note { + font-size: 0.8em; + color: transparentize($fg-color, $amount: 0.5); + } + + .id { + font-family: $mono-font; + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/services/brightness.js b/home/isabel/programs/configs/gui/bars/ags/config/services/brightness.js index b1430ee1..1a421df7 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/services/brightness.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/services/brightness.js @@ -3,45 +3,45 @@ import Service from "resource:///com/github/Aylur/ags/service.js"; import { dependencies } from "../utils.js"; class Brightness extends Service { - static { - Service.register( - this, - {}, - { - screen: ["float", "rw"], - }, - ); - } - - #screen = 0; - - get screen() { - return this.#screen; - } - - set screen(percent) { - if (!dependencies(["brightnessctl"])) return; - - if (percent < 0) percent = 0; - - if (percent > 1) percent = 1; - - Utils.execAsync(`brightnessctl s ${percent * 100}% -q`) - .then(() => { - this.#screen = percent; - this.changed("screen"); - }) - .catch(console.error); - } - - constructor() { - super(); - if (dependencies(["brightnessctl"])) { - this.#screen = - Number(Utils.exec("brightnessctl g")) / - Number(Utils.exec("brightnessctl m")); - } + static { + Service.register( + this, + {}, + { + screen: ["float", "rw"], + }, + ); + } + + #screen = 0; + + get screen() { + return this.#screen; + } + + set screen(percent) { + if (!dependencies(["brightnessctl"])) return; + + if (percent < 0) percent = 0; + + if (percent > 1) percent = 1; + + Utils.execAsync(`brightnessctl s ${percent * 100}% -q`) + .then(() => { + this.#screen = percent; + this.changed("screen"); + }) + .catch(console.error); + } + + constructor() { + super(); + if (dependencies(["brightnessctl"])) { + this.#screen = + Number(Utils.exec("brightnessctl g")) / + Number(Utils.exec("brightnessctl m")); } + } } export default new Brightness(); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/services/colorpicker.js b/home/isabel/programs/configs/gui/bars/ags/config/services/colorpicker.js index 25abd49a..65398a22 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/services/colorpicker.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/services/colorpicker.js @@ -7,67 +7,67 @@ import { dependencies } from "../utils.js"; const COLORS_CACHE = Utils.CACHE_DIR + "/colorpicker.json"; class Colors extends Service { - static { - Service.register( - this, - {}, - { - colors: ["jsobject"], - }, - ); - } - - /** @type {Variable} */ - #colors = new Variable([]); - get colors() { - return this.#colors.value; - } + static { + Service.register( + this, + {}, + { + colors: ["jsobject"], + }, + ); + } - #notifID = 0; + /** @type {Variable} */ + #colors = new Variable([]); + get colors() { + return this.#colors.value; + } - constructor() { - super(); + #notifID = 0; - this.#colors.connect("changed", () => this.changed("colors")); + constructor() { + super(); - Utils.readFileAsync(COLORS_CACHE) - .then((out) => this.#colors.setValue(JSON.parse(out || "[]"))) - .catch(() => print("no colorpicker cache found")); - } + this.#colors.connect("changed", () => this.changed("colors")); - /** @param {string} color */ - wlCopy(color) { - Utils.execAsync(["wl-copy", color]).catch((err) => console.error(err)); - } + Utils.readFileAsync(COLORS_CACHE) + .then((out) => this.#colors.setValue(JSON.parse(out || "[]"))) + .catch(() => print("no colorpicker cache found")); + } - async pick() { - if (!dependencies(["hyprpicker"])) return; + /** @param {string} color */ + wlCopy(color) { + Utils.execAsync(["wl-copy", color]).catch((err) => console.error(err)); + } - const color = await Utils.execAsync("hyprpicker"); - if (!color) return; + async pick() { + if (!dependencies(["hyprpicker"])) return; - this.wlCopy(color); - const list = this.#colors.value; - if (!list.includes(color)) { - list.push(color); - if (list.length > 10) list.shift(); + const color = await Utils.execAsync("hyprpicker"); + if (!color) return; - this.#colors.value = list; - Utils.writeFile(JSON.stringify(list, null, 2), COLORS_CACHE).catch( - (err) => console.error(err), - ); - } + this.wlCopy(color); + const list = this.#colors.value; + if (!list.includes(color)) { + list.push(color); + if (list.length > 10) list.shift(); - this.#notifID = Notifications.Notify( - "Color Picker", - this.#notifID, - "color-select-symbolic", - color, - "", - [], - {}, - ); + this.#colors.value = list; + Utils.writeFile(JSON.stringify(list, null, 2), COLORS_CACHE).catch( + (err) => console.error(err), + ); } + + this.#notifID = Notifications.Notify( + "Color Picker", + this.#notifID, + "color-select-symbolic", + color, + "", + [], + {}, + ); + } } export default new Colors(); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/services/onScreenIndicator.js b/home/isabel/programs/configs/gui/bars/ags/config/services/onScreenIndicator.js index 60635367..8854b931 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/services/onScreenIndicator.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/services/onScreenIndicator.js @@ -6,41 +6,41 @@ import { getAudioTypeIcon } from "../utils.js"; import Brightness from "./brightness.js"; class Indicator extends Service { - static { - Service.register(this, { - popup: ["double", "string"], - }); - } + static { + Service.register(this, { + popup: ["double", "string"], + }); + } - #delay = 1500; - #count = 0; - /** - * @param {number} value - 0 < v < 1 - * @param {string} icon - */ - popup(value, icon) { - this.emit("popup", value, icon); - this.#count++; - Utils.timeout(this.#delay, () => { - this.#count--; + #delay = 1500; + #count = 0; + /** + * @param {number} value - 0 < v < 1 + * @param {string} icon + */ + popup(value, icon) { + this.emit("popup", value, icon); + this.#count++; + Utils.timeout(this.#delay, () => { + this.#count--; - if (this.#count === 0) this.emit("popup", -1, icon); - }); - } + if (this.#count === 0) this.emit("popup", -1, icon); + }); + } - speaker() { - this.popup( - Audio.speaker?.volume || 0, - getAudioTypeIcon(Audio.speaker?.icon_name || ""), - ); - } + speaker() { + this.popup( + Audio.speaker?.volume || 0, + getAudioTypeIcon(Audio.speaker?.icon_name || ""), + ); + } - display() { - // brightness is async, so lets wait a bit - Utils.timeout(10, () => - this.popup(Brightness.screen, icons.brightness.screen), - ); - } + display() { + // brightness is async, so lets wait a bit + Utils.timeout(10, () => + this.popup(Brightness.screen, icons.brightness.screen), + ); + } } export default new Indicator(); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/services/powermenu.js b/home/isabel/programs/configs/gui/bars/ags/config/services/powermenu.js index 874c44f8..e49afc3d 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/services/powermenu.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/services/powermenu.js @@ -2,41 +2,41 @@ import App from "resource:///com/github/Aylur/ags/app.js"; import Service from "resource:///com/github/Aylur/ags/service.js"; class PowerMenu extends Service { - static { - Service.register( - this, - {}, - { - title: ["string"], - cmd: ["string"], - }, - ); - } + static { + Service.register( + this, + {}, + { + title: ["string"], + cmd: ["string"], + }, + ); + } - #title = ""; - #cmd = ""; + #title = ""; + #cmd = ""; - get title() { - return this.#title; - } - get cmd() { - return this.#cmd; - } + get title() { + return this.#title; + } + get cmd() { + return this.#cmd; + } - /** @param {'sleep' | 'reboot' | 'logout' | 'shutdown'} action */ - action(action) { - [this.#cmd, this.#title] = { - sleep: ["systemctl suspend", "Sleep"], - reboot: ["systemctl reboot", "Reboot"], - logout: ["hyprctl dispatch exit 0", "Log Out"], - shutdown: ["shutdown now", "Shutdown"], - }[action]; + /** @param {'sleep' | 'reboot' | 'logout' | 'shutdown'} action */ + action(action) { + [this.#cmd, this.#title] = { + sleep: ["systemctl suspend", "Sleep"], + reboot: ["systemctl reboot", "Reboot"], + logout: ["hyprctl dispatch exit 0", "Log Out"], + shutdown: ["shutdown now", "Shutdown"], + }[action]; - this.notify("cmd"); - this.notify("title"); - this.emit("changed"); - App.closeWindow("powermenu"); - } + this.notify("cmd"); + this.notify("title"); + this.emit("changed"); + App.closeWindow("powermenu"); + } } export default new PowerMenu(); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/SettingsDialog.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/SettingsDialog.js index c9744010..acd394ab 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/SettingsDialog.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/SettingsDialog.js @@ -8,321 +8,312 @@ import options from "../options.js"; const optionsList = getOptions(); const categories = Array.from( - new Set(optionsList.map((opt) => opt.category)), + new Set(optionsList.map((opt) => opt.category)), ).filter((category) => category !== "exclude"); const currentPage = Variable(categories[0]); const search = Variable(""); const showSearch = Variable(false); showSearch.connect("changed", ({ value }) => { - if (!value) search.value = ""; + if (!value) search.value = ""; }); /** @param {import('./option.js').Opt} opt */ const EnumSetter = (opt) => { - const lbl = Widget.Label({ binds: [["label", opt]] }); - const step = (dir = 1) => { - const i = opt.enums.findIndex((i) => i === lbl.label); - opt.setValue( - dir > 0 - ? i + dir > opt.enums.length - 1 - ? opt.enums[0] - : opt.enums[i + dir] - : i + dir < 0 - ? opt.enums[opt.enums.length - 1] - : opt.enums[i + dir], - true, - ); - }; - const next = Widget.Button({ - child: Widget.Icon(icons.ui.arrow.right), - on_clicked: () => step(+1), - }); - const prev = Widget.Button({ - child: Widget.Icon(icons.ui.arrow.left), - on_clicked: () => step(-1), - }); - return Widget.Box({ - class_name: "enum-setter", - children: [prev, lbl, next], - }); + const lbl = Widget.Label({ binds: [["label", opt]] }); + const step = (dir = 1) => { + const i = opt.enums.findIndex((i) => i === lbl.label); + opt.setValue( + dir > 0 + ? i + dir > opt.enums.length - 1 + ? opt.enums[0] + : opt.enums[i + dir] + : i + dir < 0 + ? opt.enums[opt.enums.length - 1] + : opt.enums[i + dir], + true, + ); + }; + const next = Widget.Button({ + child: Widget.Icon(icons.ui.arrow.right), + on_clicked: () => step(+1), + }); + const prev = Widget.Button({ + child: Widget.Icon(icons.ui.arrow.left), + on_clicked: () => step(-1), + }); + return Widget.Box({ + class_name: "enum-setter", + children: [prev, lbl, next], + }); }; /** @param {import('./option.js').Opt} opt */ const Setter = (opt) => { - switch (opt.type) { - case "number": - return Widget.SpinButton({ - setup(self) { - self.set_range(0, 1000); - self.set_increments(1, 5); - }, - connections: [ - ["value-changed", (self) => opt.setValue(self.value, true)], - [opt, (self) => (self.value = opt.value)], - ], - }); - case "float": - case "object": - return Widget.Entry({ - on_accept: (self) => - opt.setValue(JSON.parse(self.text || ""), true), - connections: [ - [opt, (self) => (self.text = JSON.stringify(opt.value))], - ], - }); - case "string": - return Widget.Entry({ - on_accept: (self) => opt.setValue(self.text, true), - connections: [[opt, (self) => (self.text = opt.value)]], - }); - case "enum": - return EnumSetter(opt); - case "boolean": - return Widget.Switch({ - connections: [ - [ - "notify::active", - (self) => opt.setValue(self.active, true), - ], - [opt, (self) => (self.active = opt.value)], - ], - }); - case "img": - return Widget.FileChooserButton({ - connections: [ - [ - "selection-changed", - (self) => { - opt.setValue( - self.get_uri()?.replace("file://", ""), - true, - ); - }, - ], - ], - }); - case "font": - return Widget.FontButton({ - show_size: false, - use_size: false, - connections: [ - ["notify::font", ({ font }) => opt.setValue(font, true)], - [opt, (self) => (self.font = opt.value)], - ], - }); - default: - return Widget.Label({ - label: "no setter with type " + opt.type, - }); - } + switch (opt.type) { + case "number": + return Widget.SpinButton({ + setup(self) { + self.set_range(0, 1000); + self.set_increments(1, 5); + }, + connections: [ + ["value-changed", (self) => opt.setValue(self.value, true)], + [opt, (self) => (self.value = opt.value)], + ], + }); + case "float": + case "object": + return Widget.Entry({ + on_accept: (self) => opt.setValue(JSON.parse(self.text || ""), true), + connections: [[opt, (self) => (self.text = JSON.stringify(opt.value))]], + }); + case "string": + return Widget.Entry({ + on_accept: (self) => opt.setValue(self.text, true), + connections: [[opt, (self) => (self.text = opt.value)]], + }); + case "enum": + return EnumSetter(opt); + case "boolean": + return Widget.Switch({ + connections: [ + ["notify::active", (self) => opt.setValue(self.active, true)], + [opt, (self) => (self.active = opt.value)], + ], + }); + case "img": + return Widget.FileChooserButton({ + connections: [ + [ + "selection-changed", + (self) => { + opt.setValue(self.get_uri()?.replace("file://", ""), true); + }, + ], + ], + }); + case "font": + return Widget.FontButton({ + show_size: false, + use_size: false, + connections: [ + ["notify::font", ({ font }) => opt.setValue(font, true)], + [opt, (self) => (self.font = opt.value)], + ], + }); + default: + return Widget.Label({ + label: "no setter with type " + opt.type, + }); + } }; /** @param {import('./option.js').Opt} opt */ const Row = (opt) => - Widget.Box({ - class_name: "row", - setup: (self) => (self.opt = opt), + Widget.Box({ + class_name: "row", + setup: (self) => (self.opt = opt), + children: [ + Widget.Box({ + vertical: true, + vpack: "center", children: [ - Widget.Box({ - vertical: true, - vpack: "center", - children: [ - opt.title && - Widget.Label({ - xalign: 0, - class_name: "summary", - label: opt.title, - }), - Widget.Label({ - xalign: 0, - class_name: "id", - label: `id: "${opt.id}"`, - }), - ], + opt.title && + Widget.Label({ + xalign: 0, + class_name: "summary", + label: opt.title, }), - Widget.Box({ hexpand: true }), - Widget.Box({ - vpack: "center", - vertical: true, - children: [ - Widget.Box({ - hpack: "end", - child: Setter(opt), - }), - opt.note && - Widget.Label({ - xalign: 1, - class_name: "note", - label: opt.note, - }), - ], + Widget.Label({ + xalign: 0, + class_name: "id", + label: `id: "${opt.id}"`, + }), + ], + }), + Widget.Box({ hexpand: true }), + Widget.Box({ + vpack: "center", + vertical: true, + children: [ + Widget.Box({ + hpack: "end", + child: Setter(opt), + }), + opt.note && + Widget.Label({ + xalign: 1, + class_name: "note", + label: opt.note, }), ], - }); + }), + ], + }); /** @param {string} category */ const Page = (category) => - Widget.Scrollable({ + Widget.Scrollable({ + vexpand: true, + class_name: "page", + child: Widget.Box({ + class_name: "page-content vertical", + vertical: true, + connections: [ + [ + search, + (self) => { + for (const child of self.children) { + child.visible = + child.opt.id.includes(search.value) || + child.opt.title.includes(search.value) || + child.opt.note.includes(search.value); + } + }, + ], + ], + children: optionsList + .filter((opt) => opt.category.includes(category)) + .map(Row), + }), + }); + +const sidebar = Widget.Revealer({ + binds: [["reveal-child", search, "value", (v) => !v]], + transition: "slide_right", + child: Widget.Box({ + hexpand: false, + vertical: true, + children: [ + Widget.Box({ + class_name: "sidebar-header", + child: Widget.Button({ + hexpand: true, + label: icons.dialog.Search + " Search", + on_clicked: () => (showSearch.value = !showSearch.value), + }), + }), + Widget.Scrollable({ vexpand: true, - class_name: "page", + hscroll: "never", child: Widget.Box({ - class_name: "page-content vertical", - vertical: true, - connections: [ - [ - search, - (self) => { - for (const child of self.children) { - child.visible = - child.opt.id.includes(search.value) || - child.opt.title.includes(search.value) || - child.opt.note.includes(search.value); - } - }, + class_name: "sidebar-box vertical", + vertical: true, + children: [ + ...categories.map((name) => + Widget.Button({ + label: (icons.dialog[name] || "") + " " + name, + xalign: 0, + binds: [ + [ + "class-name", + currentPage, + "value", + (v) => (v === name ? "active" : ""), + ], ], - ], - children: optionsList - .filter((opt) => opt.category.includes(category)) - .map(Row), + on_clicked: () => currentPage.setValue(name), + }), + ), + ], }), - }); - -const sidebar = Widget.Revealer({ - binds: [["reveal-child", search, "value", (v) => !v]], - transition: "slide_right", - child: Widget.Box({ - hexpand: false, - vertical: true, - children: [ - Widget.Box({ - class_name: "sidebar-header", - child: Widget.Button({ - hexpand: true, - label: icons.dialog.Search + " Search", - on_clicked: () => (showSearch.value = !showSearch.value), - }), - }), - Widget.Scrollable({ - vexpand: true, - hscroll: "never", - child: Widget.Box({ - class_name: "sidebar-box vertical", - vertical: true, - children: [ - ...categories.map((name) => - Widget.Button({ - label: (icons.dialog[name] || "") + " " + name, - xalign: 0, - binds: [ - [ - "class-name", - currentPage, - "value", - (v) => (v === name ? "active" : ""), - ], - ], - on_clicked: () => currentPage.setValue(name), - }), - ), - ], - }), - }), - Widget.Box({ - class_name: "sidebar-footer", - child: Widget.Button({ - class_name: "copy", - child: Widget.Label({ - label: " Save", - xalign: 0, - }), - hexpand: true, - on_clicked: () => { - Utils.execAsync(["wl-copy", getValues()]); - print(getValues()); - Utils.execAsync([ - "notify-send", - "-i", - "preferences-desktop-theme-symbolic", - "Theme copied to clipboard", - 'To save it permanently, make a new theme in themes.js', - ]); - }, - }), - }), - ], - }), + }), + Widget.Box({ + class_name: "sidebar-footer", + child: Widget.Button({ + class_name: "copy", + child: Widget.Label({ + label: " Save", + xalign: 0, + }), + hexpand: true, + on_clicked: () => { + Utils.execAsync(["wl-copy", getValues()]); + print(getValues()); + Utils.execAsync([ + "notify-send", + "-i", + "preferences-desktop-theme-symbolic", + "Theme copied to clipboard", + 'To save it permanently, make a new theme in themes.js', + ]); + }, + }), + }), + ], + }), }); const searchEntry = Widget.Revealer({ - transition: "slide_down", - binds: [ - ["reveal-child", showSearch], - ["transition-duration", options.transition], - ], - child: Widget.Entry({ - connections: [ - [ - showSearch, - (self) => { - if (!showSearch.value) self.text = ""; + transition: "slide_down", + binds: [ + ["reveal-child", showSearch], + ["transition-duration", options.transition], + ], + child: Widget.Entry({ + connections: [ + [ + showSearch, + (self) => { + if (!showSearch.value) self.text = ""; - if (showSearch.value) self.grab_focus(); - }, - ], - ], - hexpand: true, - class_name: "search", - placeholder_text: "Search Options", - secondary_icon_name: icons.apps.search, - on_change: ({ text }) => (search.value = text || ""), - }), + if (showSearch.value) self.grab_focus(); + }, + ], + ], + hexpand: true, + class_name: "search", + placeholder_text: "Search Options", + secondary_icon_name: icons.apps.search, + on_change: ({ text }) => (search.value = text || ""), + }), }); const categoriesStack = Widget.Stack({ - transition: "slide_left_right", - items: categories.map((name) => [name, Page(name)]), - binds: [ - ["shown", currentPage], - ["visible", search, "value", (v) => !v], - ], + transition: "slide_left_right", + items: categories.map((name) => [name, Page(name)]), + binds: [ + ["shown", currentPage], + ["visible", search, "value", (v) => !v], + ], }); const searchPage = Widget.Box({ - binds: [["visible", search, "value", (v) => !!v]], - child: Page(""), + binds: [["visible", search, "value", (v) => !!v]], + child: Page(""), }); export default RegularWindow({ - name: "settings-dialog", - title: "Settings", - setup: (win) => win.set_default_size(800, 500), - connections: [ - [ - "delete-event", - (win) => { - win.hide(); - return true; - }, - ], - [ - "key-press-event", - (self, event) => { - if (event.get_keyval()[1] === imports.gi.Gdk.KEY_Escape) { - self.text = ""; - showSearch.setValue(false); - search.setValue(""); - } - }, - ], + name: "settings-dialog", + title: "Settings", + setup: (win) => win.set_default_size(800, 500), + connections: [ + [ + "delete-event", + (win) => { + win.hide(); + return true; + }, ], - child: Widget.Box({ - children: [ - sidebar, - Widget.Box({ - vertical: true, - children: [searchEntry, categoriesStack, searchPage], - }), - ], - }), + [ + "key-press-event", + (self, event) => { + if (event.get_keyval()[1] === imports.gi.Gdk.KEY_Escape) { + self.text = ""; + showSearch.setValue(false); + search.setValue(""); + } + }, + ], + ], + child: Widget.Box({ + children: [ + sidebar, + Widget.Box({ + vertical: true, + children: [searchEntry, categoriesStack, searchPage], + }), + ], + }), }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/globals.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/globals.js index df54b763..5ab5156c 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/globals.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/globals.js @@ -1,24 +1,24 @@ import Mpris from "resource:///com/github/Aylur/ags/service/mpris.js"; export async function globals() { - globalThis.options = (await import("../options.js")).default; - globalThis.iconBrowser = (await import("../misc/IconBrowser.js")).default; - globalThis.app = ( - await import("resource:///com/github/Aylur/ags/app.js") - ).default; - globalThis.audio = ( - await import("resource:///com/github/Aylur/ags/service/audio.js") - ).default; - globalThis.brightness = (await import("../services/brightness.js")).default; - globalThis.indicator = ( - await import("../services/onScreenIndicator.js") - ).default; - Mpris.connect("player-added", (mpris, bus) => { - mpris.getPlayer(bus)?.connect("changed", (player) => { - globalThis.mpris = player || Mpris.players[0]; - }); - }); - Mpris.connect("player-closed", () => { - globalThis.mpris = Mpris.players[0]; + globalThis.options = (await import("../options.js")).default; + globalThis.iconBrowser = (await import("../misc/IconBrowser.js")).default; + globalThis.app = ( + await import("resource:///com/github/Aylur/ags/app.js") + ).default; + globalThis.audio = ( + await import("resource:///com/github/Aylur/ags/service/audio.js") + ).default; + globalThis.brightness = (await import("../services/brightness.js")).default; + globalThis.indicator = ( + await import("../services/onScreenIndicator.js") + ).default; + Mpris.connect("player-added", (mpris, bus) => { + mpris.getPlayer(bus)?.connect("changed", (player) => { + globalThis.mpris = player || Mpris.players[0]; }); + }); + Mpris.connect("player-closed", () => { + globalThis.mpris = Mpris.players[0]; + }); } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/hyprland.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/hyprland.js index 4da6e8fd..e7a329fa 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/hyprland.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/hyprland.js @@ -7,43 +7,42 @@ const noIgnorealpha = ["verification", "powermenu"]; /** @param {Array} batch */ function sendBatch(batch) { - const cmd = batch - .filter((x) => !!x) - .map((x) => `keyword ${x}`) - .join("; "); + const cmd = batch + .filter((x) => !!x) + .map((x) => `keyword ${x}`) + .join("; "); - Hyprland.sendMessage(`[[BATCH]]/${cmd}`); + Hyprland.sendMessage(`[[BATCH]]/${cmd}`); } export function hyprlandInit() { - if (readFile("/tmp/ags/hyprland-init")) return; - - sendBatch( - Array.from(App.windows).flatMap(([name]) => [ - `layerrule blur, ${name}`, - noIgnorealpha.some((skip) => name.includes(skip)) - ? "" - : `layerrule ignorealpha 0.6, ${name}`, - ]), - ); - - writeFile("init", "/tmp/ags/hyprland-init"); - setupHyprland(); + if (readFile("/tmp/ags/hyprland-init")) return; + + sendBatch( + Array.from(App.windows).flatMap(([name]) => [ + `layerrule blur, ${name}`, + noIgnorealpha.some((skip) => name.includes(skip)) + ? "" + : `layerrule ignorealpha 0.6, ${name}`, + ]), + ); + + writeFile("init", "/tmp/ags/hyprland-init"); + setupHyprland(); } export async function setupHyprland() { - const wm_gaps = options.hypr.wm_gaps.value; - const bar_style = options.bar.style.value; - const bar_pos = options.bar.position.value; + const wm_gaps = options.hypr.wm_gaps.value; + const bar_style = options.bar.style.value; + const bar_pos = options.bar.position.value; - const batch = []; + const batch = []; - JSON.parse(await Hyprland.sendMessage("j/monitors")).forEach(({ name }) => { - const v = bar_pos === "top" ? `-${wm_gaps},0,0,0` : `0,-${wm_gaps},0,0`; - if (bar_style !== "normal") - batch.push(`monitor ${name},addreserved,${v}`); - else batch.push(`monitor ${name},addreserved,0,0,0,0`); - }); + JSON.parse(await Hyprland.sendMessage("j/monitors")).forEach(({ name }) => { + const v = bar_pos === "top" ? `-${wm_gaps},0,0,0` : `0,-${wm_gaps},0,0`; + if (bar_style !== "normal") batch.push(`monitor ${name},addreserved,${v}`); + else batch.push(`monitor ${name},addreserved,0,0,0,0`); + }); - sendBatch(batch); + sendBatch(batch); } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/option.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/option.js index d2da8b10..63098dcc 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/option.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/option.js @@ -1,7 +1,7 @@ import { - CACHE_DIR, - readFile, - writeFile, + CACHE_DIR, + readFile, + writeFile, } from "resource:///com/github/Aylur/ags/utils.js"; import { exec } from "resource:///com/github/Aylur/ags/utils.js"; import options from "../options.js"; @@ -31,112 +31,110 @@ let cacheObj = JSON.parse(readFile(CACHE_FILE) || "{}"); /** @template T */ export class Opt extends Service { - static { - Service.register( - this, - {}, - { - value: ["jsobject"], - }, - ); - } - - #value; - #scss = ""; - unit = "px"; - noReload = false; - id = ""; - title = ""; - note = ""; - type = ""; - category = ""; - - /** @type {Array} */ - enums = []; - - /** @type {(v: T) => any} */ - format = (v) => v; - - /** @type {(v: T) => any} */ - scssFormat = (v) => v; - - /** - * @param {T} value - * @param {OptionConfig =} config - */ - constructor(value, config) { - super(); - this.#value = value; - this.defaultValue = value; - this.type = typeof value; - - if (config) Object.keys(config).forEach((c) => (this[c] = config[c])); - - import("../options.js").then(this.#init.bind(this)); - } - - set scss(scss) { - this.#scss = scss; - } - get scss() { - return this.#scss || this.id.split(".").join("-").split("_").join("-"); - } - - #init() { - getOptions(); // sets the ids as a side effect - - if (cacheObj[this.id] !== undefined) this.setValue(cacheObj[this.id]); - - const words = this.id - .split(".") - .flatMap((w) => w.split("_")) - .map((word) => word.charAt(0).toUpperCase() + word.slice(1)); - - this.title ||= words.join(" "); - this.category ||= - words.length === 1 ? "General" : words.at(0) || "General"; - - this.connect("changed", () => { - cacheObj[this.id] = this.value; - writeFile(JSON.stringify(cacheObj, null, 2), CACHE_FILE); - }); + static { + Service.register( + this, + {}, + { + value: ["jsobject"], + }, + ); + } + + #value; + #scss = ""; + unit = "px"; + noReload = false; + id = ""; + title = ""; + note = ""; + type = ""; + category = ""; + + /** @type {Array} */ + enums = []; + + /** @type {(v: T) => any} */ + format = (v) => v; + + /** @type {(v: T) => any} */ + scssFormat = (v) => v; + + /** + * @param {T} value + * @param {OptionConfig =} config + */ + constructor(value, config) { + super(); + this.#value = value; + this.defaultValue = value; + this.type = typeof value; + + if (config) Object.keys(config).forEach((c) => (this[c] = config[c])); + + import("../options.js").then(this.#init.bind(this)); + } + + set scss(scss) { + this.#scss = scss; + } + get scss() { + return this.#scss || this.id.split(".").join("-").split("_").join("-"); + } + + #init() { + getOptions(); // sets the ids as a side effect + + if (cacheObj[this.id] !== undefined) this.setValue(cacheObj[this.id]); + + const words = this.id + .split(".") + .flatMap((w) => w.split("_")) + .map((word) => word.charAt(0).toUpperCase() + word.slice(1)); + + this.title ||= words.join(" "); + this.category ||= words.length === 1 ? "General" : words.at(0) || "General"; + + this.connect("changed", () => { + cacheObj[this.id] = this.value; + writeFile(JSON.stringify(cacheObj, null, 2), CACHE_FILE); + }); + } + + get value() { + return this.#value; + } + set value(value) { + this.setValue(value); + } + + /** @param {T} value */ + setValue(value, reload = false) { + if (typeof value !== typeof this.defaultValue) { + console.error( + Error( + `WrongType: Option "${this.id}" can't be set to ${value}, ` + + `expected "${typeof this.defaultValue}", but got "${typeof value}"`, + ), + ); + + return; } - get value() { - return this.#value; - } - set value(value) { - this.setValue(value); - } + if (this.value !== value) { + this.#value = this.format(value); + this.changed("value"); - /** @param {T} value */ - setValue(value, reload = false) { - if (typeof value !== typeof this.defaultValue) { - console.error( - Error( - `WrongType: Option "${this.id}" can't be set to ${value}, ` + - `expected "${typeof this - .defaultValue}", but got "${typeof value}"`, - ), - ); - - return; - } - - if (this.value !== value) { - this.#value = this.format(value); - this.changed("value"); - - if (reload && !this.noReload) { - reloadScss(); - setupHyprland(); - } - } + if (reload && !this.noReload) { + reloadScss(); + setupHyprland(); + } } + } - reset(reload = false) { - this.setValue(this.defaultValue, reload); - } + reset(reload = false) { + this.setValue(this.defaultValue, reload); + } } /** @@ -146,54 +144,54 @@ export class Opt extends Service { * @returns {Opt} */ export function Option(value, config) { - return new Opt(value, config); + return new Opt(value, config); } /** @returns {Array>} */ export function getOptions(object = options, path = "") { - return Object.keys(object).flatMap((key) => { - /** @type Option */ - const obj = object[key]; - const id = path ? path + "." + key : key; - - if (obj instanceof Opt) { - obj.id = id; - return obj; - } + return Object.keys(object).flatMap((key) => { + /** @type Option */ + const obj = object[key]; + const id = path ? path + "." + key : key; + + if (obj instanceof Opt) { + obj.id = id; + return obj; + } - if (typeof obj === "object") return getOptions(obj, id); + if (typeof obj === "object") return getOptions(obj, id); - return []; - }); + return []; + }); } export function resetOptions() { - exec(`rm -rf ${CACHE_FILE}`); - cacheObj = {}; - getOptions().forEach((opt) => opt.reset()); + exec(`rm -rf ${CACHE_FILE}`); + cacheObj = {}; + getOptions().forEach((opt) => opt.reset()); } export function getValues() { - const obj = {}; - for (const opt of getOptions()) { - if (opt.category !== "exclude") obj[opt.id] = opt.value; - } + const obj = {}; + for (const opt of getOptions()) { + if (opt.category !== "exclude") obj[opt.id] = opt.value; + } - return JSON.stringify(obj, null, 2); + return JSON.stringify(obj, null, 2); } /** @param {string | object} config */ export function apply(config) { - const options = getOptions(); - const settings = typeof config === "string" ? JSON.parse(config) : config; - - for (const id of Object.keys(settings)) { - const opt = options.find((opt) => opt.id === id); - if (!opt) { - print(`No option with id: "${id}"`); - continue; - } - - opt.setValue(settings[id]); + const options = getOptions(); + const settings = typeof config === "string" ? JSON.parse(config) : config; + + for (const id of Object.keys(settings)) { + const opt = options.find((opt) => opt.id === id); + if (!opt) { + print(`No option with id: "${id}"`); + continue; } + + opt.setValue(settings[id]); + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/scss.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/scss.js index afd13b6c..b6673dd6 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/scss.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/scss.js @@ -4,18 +4,18 @@ import { getOptions } from "./option.js"; import { dependencies } from "../utils.js"; export function scssWatcher() { - return Utils.subprocess( - [ - "inotifywait", - "--recursive", - "--event", - "create,modify", - "-m", - App.configDir + "/scss", - ], - reloadScss, - () => print("missing dependancy for css hotreload: inotify-tools"), - ); + return Utils.subprocess( + [ + "inotifywait", + "--recursive", + "--event", + "create,modify", + "-m", + App.configDir + "/scss", + ], + reloadScss, + () => print("missing dependancy for css hotreload: inotify-tools"), + ); } /** @@ -26,24 +26,24 @@ export function scssWatcher() { * options.bar.style.value => $bar-style */ export async function reloadScss() { - if (!dependencies(["sassc"])) return; + if (!dependencies(["sassc"])) return; - const opts = getOptions(); - const vars = opts.map((opt) => { - if (opt.scss === "exclude") return ""; + const opts = getOptions(); + const vars = opts.map((opt) => { + if (opt.scss === "exclude") return ""; - const name = opt.id.split(".").join("-").split("_").join("-"); - const unit = typeof opt.value === "number" ? opt.unit : ""; - const value = opt.scssFormat ? opt.scssFormat(opt.value) : opt.value; - print(opt.scss, opt.id); - return `$${opt.scss || name}: ${value}${unit};`; - }); + const name = opt.id.split(".").join("-").split("_").join("-"); + const unit = typeof opt.value === "number" ? opt.unit : ""; + const value = opt.scssFormat ? opt.scssFormat(opt.value) : opt.value; + print(opt.scss, opt.id); + return `$${opt.scss || name}: ${value}${unit};`; + }); - const bar_style = opts.find((opt) => opt.id === "bar.style")?.value || ""; - const additional = - bar_style === "normal" - ? "//" - : ` + const bar_style = opts.find((opt) => opt.id === "bar.style")?.value || ""; + const additional = + bar_style === "normal" + ? "//" + : ` window#quicksettings .window-content { margin-right: $wm-gaps; } @@ -53,19 +53,19 @@ export async function reloadScss() { } `; - try { - const tmp = "/tmp/ags/scss"; - Utils.ensureDirectory(tmp); - await Utils.writeFile(vars.join("\n"), `${tmp}/options.scss`); - await Utils.writeFile(additional, `${tmp}/additional.scss`); - await Utils.execAsync( - `sassc ${App.configDir}/scss/main.scss ${tmp}/style.css`, - ); - App.resetCss(); - App.applyCss(`${tmp}/style.css`); - } catch (error) { - if (error instanceof Error) console.error(error.message); + try { + const tmp = "/tmp/ags/scss"; + Utils.ensureDirectory(tmp); + await Utils.writeFile(vars.join("\n"), `${tmp}/options.scss`); + await Utils.writeFile(additional, `${tmp}/additional.scss`); + await Utils.execAsync( + `sassc ${App.configDir}/scss/main.scss ${tmp}/style.css`, + ); + App.resetCss(); + App.applyCss(`${tmp}/style.css`); + } catch (error) { + if (error instanceof Error) console.error(error.message); - if (typeof error === "string") console.error(error); - } + if (typeof error === "string") console.error(error); + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/setup.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/setup.js index 7ce244c5..4ab220d9 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/setup.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/setup.js @@ -10,74 +10,72 @@ import { globals } from "./globals.js"; import Gtk from "gi://Gtk"; export function init() { - notificationBlacklist(); - warnOnLowBattery(); - globals(); - gsettigsColorScheme(); - gtkFontSettings(); - scssWatcher(); + notificationBlacklist(); + warnOnLowBattery(); + globals(); + gsettigsColorScheme(); + gtkFontSettings(); + scssWatcher(); - reloadScss(); - hyprlandInit(); - setupHyprland(); - wallpaper(); + reloadScss(); + hyprlandInit(); + setupHyprland(); + wallpaper(); } function gsettigsColorScheme() { - if (!Utils.exec("which gsettings")) return; + if (!Utils.exec("which gsettings")) return; - options.theme.scheme.connect("changed", ({ value }) => { - const gsettings = - "gsettings set org.gnome.desktop.interface color-scheme"; - Utils.execAsync(`${gsettings} "prefer-${value}"`).catch((err) => - console.error(err.message), - ); - }); + options.theme.scheme.connect("changed", ({ value }) => { + const gsettings = "gsettings set org.gnome.desktop.interface color-scheme"; + Utils.execAsync(`${gsettings} "prefer-${value}"`).catch((err) => + console.error(err.message), + ); + }); } function gtkFontSettings() { - const settings = Gtk.Settings.get_default(); - if (!settings) { - console.error(Error("Gtk.Settings unavailable")); - return; - } + const settings = Gtk.Settings.get_default(); + if (!settings) { + console.error(Error("Gtk.Settings unavailable")); + return; + } - const callback = () => { - const { size, font } = options.font; - settings.gtk_font_name = `${font.value} ${size.value}`; - }; + const callback = () => { + const { size, font } = options.font; + settings.gtk_font_name = `${font.value} ${size.value}`; + }; - options.font.font.connect("notify::value", callback); - options.font.size.connect("notify::value", callback); + options.font.font.connect("notify::value", callback); + options.font.size.connect("notify::value", callback); } function notificationBlacklist() { - Notifications.connect("notified", (_, id) => { - const n = Notifications.getNotification(id); - options.notifications.black_list.value.forEach((item) => { - if (n?.app_name.includes(item) || n?.app_entry?.includes(item)) - n.close(); - }); + Notifications.connect("notified", (_, id) => { + const n = Notifications.getNotification(id); + options.notifications.black_list.value.forEach((item) => { + if (n?.app_name.includes(item) || n?.app_entry?.includes(item)) n.close(); }); + }); } function warnOnLowBattery() { - Battery.connect("notify::percent", () => { - const low = options.battery.low.value; - if ( - Battery.percent !== low || - Battery.percent !== low / 2 || - !Battery.charging - ) - return; + Battery.connect("notify::percent", () => { + const low = options.battery.low.value; + if ( + Battery.percent !== low || + Battery.percent !== low / 2 || + !Battery.charging + ) + return; - Utils.execAsync([ - "notify-send", - `${Battery.percent}% Battery Percentage`, - "-i", - icons.battery.warning, - "-u", - "critical", - ]); - }); + Utils.execAsync([ + "notify-send", + `${Battery.percent}% Battery Percentage`, + "-i", + icons.battery.warning, + "-u", + "critical", + ]); + }); } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/theme.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/theme.js index 3e9dc17a..3ad67bfa 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/theme.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/theme.js @@ -7,49 +7,49 @@ import { wallpaper } from "./wallpaper.js"; /** @param {string} name */ export function setTheme(name) { - options.reset(); - const theme = themes.find((t) => t.name === name); - if (!theme) return print("No theme named " + name); + options.reset(); + const theme = themes.find((t) => t.name === name); + if (!theme) return print("No theme named " + name); - options.apply(theme.options); - reloadScss(); - setupHyprland(); - wallpaper(); + options.apply(theme.options); + reloadScss(); + setupHyprland(); + wallpaper(); } export const WP = `/home/${USER}/media/pictures/wallpapers/`; export const lightColors = { - "theme.scheme": "light", - "color.red": "#d20f39", - "color.green": "#40a02b", - "color.yellow": "#df8e1d", - "color.blue": "#209fb5", - "color.magenta": "#8839ef", - "color.teal": "#179299", - "color.orange": "#fe640b", - "theme.bg": "#eff1f5", - "theme.fg": "#4c4f69", + "theme.scheme": "light", + "color.red": "#d20f39", + "color.green": "#40a02b", + "color.yellow": "#df8e1d", + "color.blue": "#209fb5", + "color.magenta": "#8839ef", + "color.teal": "#179299", + "color.orange": "#fe640b", + "theme.bg": "#eff1f5", + "theme.fg": "#4c4f69", }; export const Theme = ({ name, icon = " ", ...options }) => ({ - name, - icon, - options: { - "theme.name": name, - "theme.icon": icon, - ...options, - }, + name, + icon, + options: { + "theme.name": name, + "theme.icon": icon, + ...options, + }, }); let settingsDialog; export async function openSettings() { - if (settingsDialog) return settingsDialog.present(); + if (settingsDialog) return settingsDialog.present(); - try { - settingsDialog = (await import("./SettingsDialog.js")).default; - settingsDialog.present(); - } catch (error) { - if (error instanceof Error) console.error(error.message); - } + try { + settingsDialog = (await import("./SettingsDialog.js")).default; + settingsDialog.present(); + } catch (error) { + if (error instanceof Error) console.error(error.message); + } } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/settings/wallpaper.js b/home/isabel/programs/configs/gui/bars/ags/config/settings/wallpaper.js index 0113bf68..b7ffdbf4 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/settings/wallpaper.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/settings/wallpaper.js @@ -3,16 +3,16 @@ import { exec, execAsync } from "resource:///com/github/Aylur/ags/utils.js"; import { dependencies } from "../utils.js"; export function initWallpaper() { - if (dependencies(["swww"])) { - exec("swww init"); - options.desktop.wallpaper.img.connect("changed", wallpaper); - } + if (dependencies(["swww"])) { + exec("swww init"); + options.desktop.wallpaper.img.connect("changed", wallpaper); + } } export function wallpaper() { - if (!dependencies(["swww"])) return; + if (!dependencies(["swww"])) return; - execAsync(["swww", "img", options.desktop.wallpaper.img.value]).catch( - (err) => console.error(err), - ); + execAsync(["swww", "img", options.desktop.wallpaper.img.value]).catch((err) => + console.error(err), + ); } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/themes.js b/home/isabel/programs/configs/gui/bars/ags/config/themes.js index 51133195..63c9f604 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/themes.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/themes.js @@ -1,15 +1,15 @@ import { Theme, WP, lightColors } from "./settings/theme.js"; export default [ - Theme({ - name: "Mocha", - icon: "", - "desktop.wallpaper.img": WP + "walking.png", - }), - Theme({ - name: "Latte", - icon: "", - "desktop.wallpaper.img": WP + "card_after_training.png", - ...lightColors, - }), + Theme({ + name: "Mocha", + icon: "", + "desktop.wallpaper.img": WP + "walking.png", + }), + Theme({ + name: "Latte", + icon: "", + "desktop.wallpaper.img": WP + "card_after_training.png", + ...lightColors, + }), ]; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/utils.js b/home/isabel/programs/configs/gui/bars/ags/config/utils.js index c8c3b5f4..ea3a17b3 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/utils.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/utils.js @@ -9,7 +9,7 @@ import Gdk from "gi://Gdk"; * @returns {Array} */ export function range(length, start = 1) { - return Array.from({ length }, (_, i) => i + start); + return Array.from({ length }, (_, i) => i + start); } /** @@ -18,7 +18,7 @@ export function range(length, start = 1) { * @returns {string} */ export function substitute(collection, item) { - return collection.find(([from]) => from === item)?.[1] || item; + return collection.find(([from]) => from === item)?.[1] || item; } /** @@ -26,8 +26,8 @@ export function substitute(collection, item) { * @returns {Array} */ export function forMonitors(widget) { - const n = Gdk.Display.get_default()?.get_n_monitors() || 1; - return range(n, 0).map(widget).flat(1); + const n = Gdk.Display.get_default()?.get_n_monitors() || 1; + return range(n, 0).map(widget).flat(1); } /** @@ -35,46 +35,46 @@ export function forMonitors(widget) { * @returns {any} - missing cairo type */ export function createSurfaceFromWidget(widget) { - const alloc = widget.get_allocation(); - const surface = new cairo.ImageSurface( - cairo.Format.ARGB32, - alloc.width, - alloc.height, - ); - const cr = new cairo.Context(surface); - cr.setSourceRGBA(255, 255, 255, 0); - cr.rectangle(0, 0, alloc.width, alloc.height); - cr.fill(); - widget.draw(cr); + const alloc = widget.get_allocation(); + const surface = new cairo.ImageSurface( + cairo.Format.ARGB32, + alloc.width, + alloc.height, + ); + const cr = new cairo.Context(surface); + cr.setSourceRGBA(255, 255, 255, 0); + cr.rectangle(0, 0, alloc.width, alloc.height); + cr.fill(); + widget.draw(cr); - return surface; + return surface; } /** @param {string} icon */ export function getAudioTypeIcon(icon) { - const substitues = [ - ["audio-headset-bluetooth", icons.audio.type.headset], - ["audio-card-analog-usb", icons.audio.type.speaker], - ["audio-card-analog-pci", icons.audio.type.card], - ]; + const substitues = [ + ["audio-headset-bluetooth", icons.audio.type.headset], + ["audio-card-analog-usb", icons.audio.type.speaker], + ["audio-card-analog-pci", icons.audio.type.card], + ]; - return substitute(substitues, icon); + return substitute(substitues, icon); } /** @param {import('types/service/applications').Application} app */ export function launchApp(app) { - Utils.execAsync(["hyprctl", "dispatch", "exec", `sh -c ${app.executable}`]); - app.frequency += 1; + Utils.execAsync(["hyprctl", "dispatch", "exec", `sh -c ${app.executable}`]); + app.frequency += 1; } /** @param {Array} bins */ export function dependencies(bins) { - const deps = bins.map((bin) => { - const has = Utils.exec(`which ${bin}`); - if (!has) print(`missing dependency: ${bin}`); + const deps = bins.map((bin) => { + const has = Utils.exec(`which ${bin}`); + if (!has) print(`missing dependency: ${bin}`); - return !!has; - }); + return !!has; + }); - return deps.every((has) => has); + return deps.every((has) => has); } diff --git a/home/isabel/programs/configs/gui/bars/ags/config/variables.js b/home/isabel/programs/configs/gui/bars/ags/config/variables.js index 32509d07..f261489c 100755 --- a/home/isabel/programs/configs/gui/bars/ags/config/variables.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/variables.js @@ -5,75 +5,75 @@ import options from "./options.js"; const interval = options.systemFetchInterval; export const uptime = Variable("", { - poll: [ - 60_000, - "cat /proc/uptime", - (line) => { - const uptime = Number.parseInt(line.split(".")[0]) / 60; - const h = Math.floor(uptime / 60); - const s = Math.floor(uptime % 60); - return `${h}:${s < 10 ? "0" + s : s}`; - }, - ], + poll: [ + 60_000, + "cat /proc/uptime", + (line) => { + const uptime = Number.parseInt(line.split(".")[0]) / 60; + const h = Math.floor(uptime / 60); + const s = Math.floor(uptime % 60); + return `${h}:${s < 10 ? "0" + s : s}`; + }, + ], }); export const distro = GLib.get_os_info("ID"); export const distroIcon = (() => { - switch (distro) { - case "fedora": - return ""; - case "arch": - return ""; - case "nixos": - return ""; - case "debian": - return ""; - case "opensuse-tumbleweed": - return ""; - case "ubuntu": - return ""; - case "endeavouros": - return ""; - default: - return ""; - } + switch (distro) { + case "fedora": + return ""; + case "arch": + return ""; + case "nixos": + return ""; + case "debian": + return ""; + case "opensuse-tumbleweed": + return ""; + case "ubuntu": + return ""; + case "endeavouros": + return ""; + default: + return ""; + } })(); /** @type {function([string, string] | string[]): number} */ const divide = ([total, free]) => free / total; export const cpu = Variable(0, { - poll: [ - interval, - "top -b -n 1", - (out) => - divide([ - 100, - out - .split("\n") - .find((line) => line.includes("Cpu(s)")) - ?.split(/\s+/)[1] - .replace(",", "."), - ]), - ], + poll: [ + interval, + "top -b -n 1", + (out) => + divide([ + 100, + out + .split("\n") + .find((line) => line.includes("Cpu(s)")) + ?.split(/\s+/)[1] + .replace(",", "."), + ]), + ], }); export const ram = Variable(0, { - poll: [ - interval, - "free", - (out) => - divide( - out - .split("\n") - .find((line) => line.includes("Mem:")) - ?.split(/\s+/) - .splice(1, 2), - ), - ], + poll: [ + interval, + "free", + (out) => + divide( + out + .split("\n") + .find((line) => line.includes("Mem:")) + ?.split(/\s+/) + .splice(1, 2), + ), + ], }); export const temp = Variable(0, { - poll: [interval, "cat " + options.temperature, (n) => n / 100_000], + poll: [interval, "cat " + options.temperature, (n) => n / 100_000], }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/AppItem.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/AppItem.js index e000ec55..c8835fef 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/AppItem.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/AppItem.js @@ -5,43 +5,43 @@ import { lookUpIcon } from "resource:///com/github/Aylur/ags/utils.js"; /** @param {import('resource:///com/github/Aylur/ags/service/applications.js').Application} app */ export default (app) => { - const title = Widget.Label({ - class_name: "title", - label: app.name, - xalign: 0, - vpack: "center", - truncate: "end", - }); + const title = Widget.Label({ + class_name: "title", + label: app.name, + xalign: 0, + vpack: "center", + truncate: "end", + }); - const description = Widget.Label({ - class_name: "description", - label: app.description || "", - wrap: true, - xalign: 0, - justification: "left", - vpack: "center", - }); + const description = Widget.Label({ + class_name: "description", + label: app.description || "", + wrap: true, + xalign: 0, + justification: "left", + vpack: "center", + }); - const icon = Widget.Icon({ - icon: lookUpIcon(app.icon_name || "") ? app.icon_name || "" : "", - binds: [["size", options.applauncher.icon_size]], - }); + const icon = Widget.Icon({ + icon: lookUpIcon(app.icon_name || "") ? app.icon_name || "" : "", + binds: [["size", options.applauncher.icon_size]], + }); - const textBox = Widget.Box({ - vertical: true, - vpack: "center", - children: app.description ? [title, description] : [title], - }); + const textBox = Widget.Box({ + vertical: true, + vpack: "center", + children: app.description ? [title, description] : [title], + }); - return Widget.Button({ - class_name: "app-item", - setup: (self) => (self.app = app), - on_clicked: () => { - App.closeWindow("applauncher"); - app.launch(); - }, - child: Widget.Box({ - children: [icon, textBox], - }), - }); + return Widget.Button({ + class_name: "app-item", + setup: (self) => (self.app = app), + on_clicked: () => { + App.closeWindow("applauncher"); + app.launch(); + }, + child: Widget.Box({ + children: [icon, textBox], + }), + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/Applauncher.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/Applauncher.js index 29b800bd..9f3c5710 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/Applauncher.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/applauncher/Applauncher.js @@ -9,68 +9,68 @@ import icons from "../../icons.js"; const WINDOW_NAME = "applauncher"; const Applauncher = () => { - const children = () => [ - ...Applications.query("").flatMap((app) => { - const item = AppItem(app); - return [ - Widget.Separator({ - hexpand: true, - binds: [["visible", item, "visible"]], - }), - item, - ]; + const children = () => [ + ...Applications.query("").flatMap((app) => { + const item = AppItem(app); + return [ + Widget.Separator({ + hexpand: true, + binds: [["visible", item, "visible"]], }), - Widget.Separator({ hexpand: true }), - ]; + item, + ]; + }), + Widget.Separator({ hexpand: true }), + ]; - const list = Widget.Box({ - vertical: true, - children: children(), - }); + const list = Widget.Box({ + vertical: true, + children: children(), + }); - const entry = Widget.Entry({ - hexpand: true, - primary_icon_name: icons.apps.search, - text: "-", - on_accept: ({ text }) => { - const list = Applications.query(text || ""); - if (list[0]) { - App.toggleWindow(WINDOW_NAME); - launchApp(list[0]); - } - }, - on_change: ({ text }) => - list.children.map((item) => { - if (item.app) item.visible = item.app.match(text); - }), - }); + const entry = Widget.Entry({ + hexpand: true, + primary_icon_name: icons.apps.search, + text: "-", + on_accept: ({ text }) => { + const list = Applications.query(text || ""); + if (list[0]) { + App.toggleWindow(WINDOW_NAME); + launchApp(list[0]); + } + }, + on_change: ({ text }) => + list.children.map((item) => { + if (item.app) item.visible = item.app.match(text); + }), + }); - return Widget.Box({ - vertical: true, - children: [ - entry, - Widget.Scrollable({ - hscroll: "never", - child: list, - }), - ], - connections: [ - [ - App, - (_, name, visible) => { - if (name !== WINDOW_NAME) return; + return Widget.Box({ + vertical: true, + children: [ + entry, + Widget.Scrollable({ + hscroll: "never", + child: list, + }), + ], + connections: [ + [ + App, + (_, name, visible) => { + if (name !== WINDOW_NAME) return; - entry.text = ""; - if (visible) entry.grab_focus(); - }, - ], - ], - }); + entry.text = ""; + if (visible) entry.grab_focus(); + }, + ], + ], + }); }; export default () => - PopupWindow({ - name: WINDOW_NAME, - transition: "slide_down", - child: Applauncher(), - }); + PopupWindow({ + name: WINDOW_NAME, + transition: "slide_down", + child: Applauncher(), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/LeftBar.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/LeftBar.js index 7902f978..1ec2ca90 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/LeftBar.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/LeftBar.js @@ -17,7 +17,7 @@ import options from "../../options.js"; const submenuItems = Variable(1); SystemTray.connect("changed", () => { - submenuItems.setValue(SystemTray.items.length + 1); + submenuItems.setValue(SystemTray.items.length + 1); }); /** @@ -26,81 +26,79 @@ SystemTray.connect("changed", () => { * @param {(self: T) => boolean=} condition */ const SeparatorDot = (service, condition) => { - const visibility = (self) => { - if (!options.bar.separators.value) return (self.visible = false); + const visibility = (self) => { + if (!options.bar.separators.value) return (self.visible = false); - self.visible = - condition && service - ? condition(service) - : options.bar.separators.value; - }; + self.visible = + condition && service ? condition(service) : options.bar.separators.value; + }; - const conn = service ? [[service, visibility]] : []; - return Widget.Separator({ - connections: [["draw", visibility], ...conn], - binds: [["visible", options.bar.separators]], - vpack: "center", - }); + const conn = service ? [[service, visibility]] : []; + return Widget.Separator({ + connections: [["draw", visibility], ...conn], + binds: [["visible", options.bar.separators]], + vpack: "center", + }); }; const Start = () => - Widget.Box({ - class_name: "start", - vertical: true, - children: [ - ApplauncherButton(), - Workspaces(), - Widget.Box({ hexpand: true }), - NotificationIndicator(), - ], - }); + Widget.Box({ + class_name: "start", + vertical: true, + children: [ + ApplauncherButton(), + Workspaces(), + Widget.Box({ hexpand: true }), + NotificationIndicator(), + ], + }); const Center = () => - Widget.Box({ - class_name: "center", - vertical: true, - children: [DateButton()], - }); + Widget.Box({ + class_name: "center", + vertical: true, + children: [DateButton()], + }); const End = () => - Widget.Box({ - class_name: "end", - vertical: true, - children: [ - SeparatorDot(Mpris, (m) => m.players.length > 0), - MediaIndicator({ vertical: true }), - Widget.Box({ hexpand: true }), + Widget.Box({ + class_name: "end", + vertical: true, + children: [ + SeparatorDot(Mpris, (m) => m.players.length > 0), + MediaIndicator({ vertical: true }), + Widget.Box({ hexpand: true }), - SubMenu({ - items: submenuItems, - children: [SysTray({ vertical: true }), ColorPicker()], - }), - SystemIndicators({ vertical: true }), - BatteryBar({ vertical: true }), - PowerMenu({ vertical: true }), - ], - }); + SubMenu({ + items: submenuItems, + children: [SysTray({ vertical: true }), ColorPicker()], + }), + SystemIndicators({ vertical: true }), + BatteryBar({ vertical: true }), + PowerMenu({ vertical: true }), + ], + }); /** @param {number} monitor */ export default (monitor) => - Widget.Window({ - name: `bar${monitor}`, - class_name: "transparent", - exclusivity: "exclusive", - monitor, - binds: [ - [ - "anchor", - options.bar.position, - "value", - (pos) => [pos, "left", "bottom"], - ], - ], - child: Widget.CenterBox({ - class_name: "panel", - vertical: true, - start_widget: Start(), - center_widget: Center(), - end_widget: End(), - }), - }); + Widget.Window({ + name: `bar${monitor}`, + class_name: "transparent", + exclusivity: "exclusive", + monitor, + binds: [ + [ + "anchor", + options.bar.position, + "value", + (pos) => [pos, "left", "bottom"], + ], + ], + child: Widget.CenterBox({ + class_name: "panel", + vertical: true, + start_widget: Start(), + center_widget: Center(), + end_widget: End(), + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/PanelButton.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/PanelButton.js index 388e3108..7076901b 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/PanelButton.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/PanelButton.js @@ -11,37 +11,37 @@ import App from "resource:///com/github/Aylur/ags/app.js"; * @param {import('types/widgets/button').ButtonProps & PanelButtonProps} o */ export default ({ - class_name, - content, - window = "", - connections = [], - ...rest + class_name, + content, + window = "", + connections = [], + ...rest }) => { - let open = false; + let open = false; - const connection = [ - [ - App, - (self, win, visible) => { - if (win !== window) return; + const connection = [ + [ + App, + (self, win, visible) => { + if (win !== window) return; - if (open && !visible) { - open = false; - self.toggleClassName("active", false); - } + if (open && !visible) { + open = false; + self.toggleClassName("active", false); + } - if (visible) { - open = true; - self.toggleClassName("active"); - } - }, - ], - ]; + if (visible) { + open = true; + self.toggleClassName("active"); + } + }, + ], + ]; - return Widget.Button({ - class_name: `panel-button ${class_name}`, - child: Widget.Box({ children: [content] }), - connections: connections.concat(connection), - ...rest, - }); + return Widget.Button({ + class_name: `panel-button ${class_name}`, + child: Widget.Box({ children: [content] }), + connections: connections.concat(connection), + ...rest, + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/TopBar.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/TopBar.js index 853c9005..8c0c3506 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/TopBar.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/TopBar.js @@ -17,7 +17,7 @@ import options from "../../options.js"; const submenuItems = Variable(1); SystemTray.connect("changed", () => { - submenuItems.setValue(SystemTray.items.length + 1); + submenuItems.setValue(SystemTray.items.length + 1); }); /** @@ -26,77 +26,75 @@ SystemTray.connect("changed", () => { * @param {(self: T) => boolean=} condition */ const SeparatorDot = (service, condition) => { - const visibility = (self) => { - if (!options.bar.separators.value) return (self.visible = false); + const visibility = (self) => { + if (!options.bar.separators.value) return (self.visible = false); - self.visible = - condition && service - ? condition(service) - : options.bar.separators.value; - }; + self.visible = + condition && service ? condition(service) : options.bar.separators.value; + }; - const conn = service ? [[service, visibility]] : []; - return Widget.Separator({ - connections: [["draw", visibility], ...conn], - binds: [["visible", options.bar.separators]], - vpack: "center", - }); + const conn = service ? [[service, visibility]] : []; + return Widget.Separator({ + connections: [["draw", visibility], ...conn], + binds: [["visible", options.bar.separators]], + vpack: "center", + }); }; const Start = () => - Widget.Box({ - class_name: "start", - children: [ - ApplauncherButton(), - Workspaces(), - Widget.Box({ hexpand: true }), - NotificationIndicator(), - ], - }); + Widget.Box({ + class_name: "start", + children: [ + ApplauncherButton(), + Workspaces(), + Widget.Box({ hexpand: true }), + NotificationIndicator(), + ], + }); const Center = () => - Widget.Box({ - class_name: "center", - children: [DateButton()], - }); + Widget.Box({ + class_name: "center", + children: [DateButton()], + }); const End = () => - Widget.Box({ - class_name: "end", - children: [ - SeparatorDot(Mpris, (m) => m.players.length > 0), - MediaIndicator(), - Widget.Box({ hexpand: true }), + Widget.Box({ + class_name: "end", + children: [ + SeparatorDot(Mpris, (m) => m.players.length > 0), + MediaIndicator(), + Widget.Box({ hexpand: true }), - SubMenu({ - items: submenuItems, - children: [SysTray(), ColorPicker()], - }), - SystemIndicators(), - BatteryBar(), - PowerMenu(), - ], - }); + SubMenu({ + items: submenuItems, + children: [SysTray(), ColorPicker()], + }), + SystemIndicators(), + BatteryBar(), + PowerMenu(), + ], + }); /** @param {number} monitor */ export default (monitor) => - Widget.Window({ - name: `bar${monitor}`, - class_name: "transparent", - exclusivity: "exclusive", - monitor, - binds: [ - [ - "anchor", - options.bar.position, - "value", - (pos) => [pos, "left", "right"], - ], - ], - child: Widget.CenterBox({ - class_name: "panel", - start_widget: Start(), - center_widget: Center(), - end_widget: End(), - }), - }); + Widget.Window({ + name: `bar${monitor}`, + class_name: "transparent", + exclusivity: "exclusive", + monitor, + binds: [ + [ + "anchor", + options.bar.position, + "value", + (pos) => [pos, "left", "right"], + ], + ], + child: Widget.CenterBox({ + class_name: "panel", + start_widget: Start(), + center_widget: Center(), + end_widget: End(), + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ApplauncherButton.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ApplauncherButton.js index 1c08624a..f7a99ac4 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ApplauncherButton.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ApplauncherButton.js @@ -4,19 +4,16 @@ import FontIcon from "../../../misc/FontIcon.js"; import { distroIcon } from "../../../variables.js"; export default () => - PanelButton({ - class_name: "applauncher", - connections: [ - [ - App, - (btn, win, visible) => { - btn.toggleClassName( - "active", - win === "applauncher" && visible, - ); - }, - ], - ], - on_clicked: () => App.toggleWindow("applauncher"), - content: FontIcon(distroIcon), - }); + PanelButton({ + class_name: "applauncher", + connections: [ + [ + App, + (btn, win, visible) => { + btn.toggleClassName("active", win === "applauncher" && visible); + }, + ], + ], + on_clicked: () => App.toggleWindow("applauncher"), + content: FontIcon(distroIcon), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/BatteryBar.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/BatteryBar.js index d0311afb..9f7a3ff2 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/BatteryBar.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/BatteryBar.js @@ -6,68 +6,65 @@ import options from "../../../options.js"; import PanelButton from "../PanelButton.js"; const Indicator = () => - Widget.Stack({ - items: [ - ["false", Widget.Icon({ binds: [["icon", Battery, "icon-name"]] })], - ["true", FontIcon(icons.battery.charging)], - ], - connections: [ - [ - Battery, - (stack) => { - stack.shown = `${Battery.charging || Battery.charged}`; - }, - ], - ], - }); + Widget.Stack({ + items: [ + ["false", Widget.Icon({ binds: [["icon", Battery, "icon-name"]] })], + ["true", FontIcon(icons.battery.charging)], + ], + connections: [ + [ + Battery, + (stack) => { + stack.shown = `${Battery.charging || Battery.charged}`; + }, + ], + ], + }); const PercentLabel = () => - Widget.Revealer({ - transition: "slide_right", - binds: [["reveal-child", options.battery.show_percentage]], - child: Widget.Label({ - binds: [["label", Battery, "percent", (p) => `${p}%`]], - }), - }); + Widget.Revealer({ + transition: "slide_right", + binds: [["reveal-child", options.battery.show_percentage]], + child: Widget.Label({ + binds: [["label", Battery, "percent", (p) => `${p}%`]], + }), + }); const LevelBar = () => - Widget.LevelBar({ - vpack: "center", - binds: [["value", Battery, "percent", (p) => p / 100]], - }); + Widget.LevelBar({ + vpack: "center", + binds: [["value", Battery, "percent", (p) => p / 100]], + }); export default () => { - const revaler = PercentLabel(); + const revaler = PercentLabel(); - return PanelButton({ - class_name: "battery-bar", - on_clicked: () => { - const v = options.battery.show_percentage.value; - options.battery.show_percentage.value = !v; - }, - content: Widget.Box({ - binds: [["visible", Battery, "available"]], - connections: [ - [ - Battery, - (w) => { - w.toggleClassName( - "charging", - Battery.charging || Battery.charged, - ); - w.toggleClassName( - "medium", - Battery.percent < options.battery.medium.value, - ); - w.toggleClassName( - "low", - Battery.percent < options.battery.low.value, - ); - w.toggleClassName("half", Battery.percent < 48); - }, - ], - ], - children: [Indicator(), Widget.Box({ child: revaler }), LevelBar()], - }), - }); + return PanelButton({ + class_name: "battery-bar", + on_clicked: () => { + const v = options.battery.show_percentage.value; + options.battery.show_percentage.value = !v; + }, + content: Widget.Box({ + binds: [["visible", Battery, "available"]], + connections: [ + [ + Battery, + (w) => { + w.toggleClassName("charging", Battery.charging || Battery.charged); + w.toggleClassName( + "medium", + Battery.percent < options.battery.medium.value, + ); + w.toggleClassName( + "low", + Battery.percent < options.battery.low.value, + ); + w.toggleClassName("half", Battery.percent < 48); + }, + ], + ], + children: [Indicator(), Widget.Box({ child: revaler }), LevelBar()], + }), + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ColorPicker.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ColorPicker.js index c3dee2cd..ca78d09a 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ColorPicker.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/ColorPicker.js @@ -4,26 +4,24 @@ import PanelButton from "../PanelButton.js"; import Gdk from "gi://Gdk"; export default () => - PanelButton({ - class_name: "color-picker", - content: Widget.Icon("color-select-symbolic"), - binds: [ - ["tooltip-text", Colors, "colors", (v) => `${v.length} colors`], - ], - on_clicked: () => Colors.pick(), + PanelButton({ + class_name: "color-picker", + content: Widget.Icon("color-select-symbolic"), + binds: [["tooltip-text", Colors, "colors", (v) => `${v.length} colors`]], + on_clicked: () => Colors.pick(), - on_secondary_click: (btn) => { - if (Colors.colors.length === 0) return; + on_secondary_click: (btn) => { + if (Colors.colors.length === 0) return; - Widget.Menu({ - class_name: "colorpicker", - children: Colors.colors.map((color) => - Widget.MenuItem({ - child: Widget.Label(color), - css: `background-color: ${color}`, - on_activate: () => Colors.wlCopy(color), - }), - ), - }).popup_at_widget(btn, Gdk.Gravity.SOUTH, Gdk.Gravity.NORTH, null); - }, - }); + Widget.Menu({ + class_name: "colorpicker", + children: Colors.colors.map((color) => + Widget.MenuItem({ + child: Widget.Label(color), + css: `background-color: ${color}`, + on_activate: () => Colors.wlCopy(color), + }), + ), + }).popup_at_widget(btn, Gdk.Gravity.SOUTH, Gdk.Gravity.NORTH, null); + }, + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/DateButton.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/DateButton.js index 6eb74e59..65e6c60c 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/DateButton.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/DateButton.js @@ -3,9 +3,9 @@ import Clock from "../../../misc/Clock.js"; import PanelButton from "../PanelButton.js"; export default ({ format = "%I:%M:%S | %d/%m/%y" } = {}) => - PanelButton({ - class_name: "dashboard panel-button", - on_clicked: () => App.toggleWindow("dashboard"), - window: "dashboard", - content: Clock({ format }), - }); + PanelButton({ + class_name: "dashboard panel-button", + on_clicked: () => App.toggleWindow("dashboard"), + window: "dashboard", + content: Clock({ format }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/MediaIndicator.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/MediaIndicator.js index 2b97156f..6e25ecff 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/MediaIndicator.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/MediaIndicator.js @@ -6,7 +6,7 @@ import * as mpris from "../../../misc/mpris.js"; import options from "../../../options.js"; export const getPlayer = (name = options.mpris.preferred.value) => - Mpris.getPlayer(name) || Mpris.players[0] || null; + Mpris.getPlayer(name) || Mpris.players[0] || null; /** * @param {Object} o @@ -14,71 +14,71 @@ export const getPlayer = (name = options.mpris.preferred.value) => * @param {import('../../misc/HoverRevealer').HoverRevealProps['direction']=} o.direction */ const Indicator = ({ player, direction = "right" }) => - HoverRevealer({ - class_name: `media panel-button ${player.name}`, - direction, - on_primary_click: () => player.playPause(), - on_scroll_up: () => player.next(), - on_scroll_down: () => player.previous(), - on_secondary_click: () => player.playPause(), - indicator: mpris.PlayerIcon(player), - child: Widget.Label({ - vexpand: true, - truncate: "end", - max_width_chars: 40, - connections: [ - [ - player, - (label) => { - label.label = `${player.track_artists.join(", ")} - ${ - player.track_title - }`; - }, - ], - ], - }), - connections: [ - [ - player, - (revealer) => { - if (revealer._current === player.track_title) return; - - revealer._current = player.track_title; - revealer.reveal_child = true; - Utils.timeout(3000, () => { - revealer.reveal_child = false; - }); - }, - ], + HoverRevealer({ + class_name: `media panel-button ${player.name}`, + direction, + on_primary_click: () => player.playPause(), + on_scroll_up: () => player.next(), + on_scroll_down: () => player.previous(), + on_secondary_click: () => player.playPause(), + indicator: mpris.PlayerIcon(player), + child: Widget.Label({ + vexpand: true, + truncate: "end", + max_width_chars: 40, + connections: [ + [ + player, + (label) => { + label.label = `${player.track_artists.join(", ")} - ${ + player.track_title + }`; + }, ], - }); + ], + }), + connections: [ + [ + player, + (revealer) => { + if (revealer._current === player.track_title) return; + + revealer._current = player.track_title; + revealer.reveal_child = true; + Utils.timeout(3000, () => { + revealer.reveal_child = false; + }); + }, + ], + ], + }); /** * @param {Object} o * @param {import('../../misc/HoverRevealer').HoverRevealProps['direction']=} o.direction */ export default ({ direction = "right" } = {}) => { - let current = null; + let current = null; - const update = (box) => { - const player = getPlayer(); - box.visible = !!player; + const update = (box) => { + const player = getPlayer(); + box.visible = !!player; - if (!player) { - current = null; - return; - } + if (!player) { + current = null; + return; + } - if (current === player) return; + if (current === player) return; - current = player; - box.children = [Indicator({ player, direction })]; - }; + current = player; + box.children = [Indicator({ player, direction })]; + }; - return Widget.Box({ - connections: [ - [options.mpris.preferred, update], - [Mpris, update, "notify::players"], - ], - }); + return Widget.Box({ + connections: [ + [options.mpris.preferred, update], + [Mpris, update, "notify::players"], + ], + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/NotificationIndicator.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/NotificationIndicator.js index ad33a1ff..a6936185 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/NotificationIndicator.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/NotificationIndicator.js @@ -10,57 +10,49 @@ import HoverRevealer from "../../../misc/HoverRevealer.js"; * @param {import('../../misc/HoverRevealer').HoverRevealProps['direction']=} o.direction */ export default ({ direction = "left" } = {}) => - HoverRevealer({ - class_name: "notifications panel-button", - eventboxConnections: [ - ["button-press-event", () => App.openWindow("dashboard")], - [ - Notifications, - (box) => - (box.visible = - Notifications.notifications.length > 0 || - Notifications.dnd), - ], - ], - connections: [ - [ - Notifications, - (revealer) => { - const title = Notifications.notifications[0]?.summary; - if (revealer._title === title) return; + HoverRevealer({ + class_name: "notifications panel-button", + eventboxConnections: [ + ["button-press-event", () => App.openWindow("dashboard")], + [ + Notifications, + (box) => + (box.visible = + Notifications.notifications.length > 0 || Notifications.dnd), + ], + ], + connections: [ + [ + Notifications, + (revealer) => { + const title = Notifications.notifications[0]?.summary; + if (revealer._title === title) return; - revealer._title = title; - revealer.reveal_child = true; - Utils.timeout(3000, () => { - revealer.reveal_child = false; - }); - }, - ], + revealer._title = title; + revealer.reveal_child = true; + Utils.timeout(3000, () => { + revealer.reveal_child = false; + }); + }, + ], + ], + direction, + indicator: Widget.Icon({ + binds: [ + [ + "icon", + Notifications, + "dnd", + (dnd) => + dnd ? icons.notifications.silent : icons.notifications.noisy, ], - direction, - indicator: Widget.Icon({ - binds: [ - [ - "icon", - Notifications, - "dnd", - (dnd) => - dnd - ? icons.notifications.silent - : icons.notifications.noisy, - ], - ], - }), - child: Widget.Label({ - truncate: "end", - max_width_chars: 40, - binds: [ - [ - "label", - Notifications, - "notifications", - (n) => n[0]?.summary || "", - ], - ], - }), - }); + ], + }), + child: Widget.Label({ + truncate: "end", + max_width_chars: 40, + binds: [ + ["label", Notifications, "notifications", (n) => n[0]?.summary || ""], + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/PowerMenu.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/PowerMenu.js index 694df428..fcc1715d 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/PowerMenu.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/PowerMenu.js @@ -4,8 +4,8 @@ import icons from "../../../icons.js"; import PanelButton from "../PanelButton.js"; export default () => - PanelButton({ - class_name: "powermenu", - content: Widget.Icon(icons.powermenu.shutdown), - on_clicked: () => App.openWindow("powermenu"), - }); + PanelButton({ + class_name: "powermenu", + content: Widget.Icon(icons.powermenu.shutdown), + on_clicked: () => App.openWindow("powermenu"), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SubMenu.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SubMenu.js index 5e380dfb..215b5d6d 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SubMenu.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SubMenu.js @@ -10,39 +10,39 @@ import options from "../../../options.js"; * @param {import('types/variable').Variable} items */ const Arrow = (revealer, direction, items) => { - let deg = 0; + let deg = 0; - const icon = Widget.Icon({ - icon: icons.ui.arrow[direction], - }); + const icon = Widget.Icon({ + icon: icons.ui.arrow[direction], + }); - const animate = () => { - const t = options.transition.value / 20; - const step = revealer.reveal_child ? 10 : -10; - for (let i = 0; i < 18; ++i) { - Utils.timeout(t * i, () => { - deg += step; - icon.setCss(`-gtk-icon-transform: rotate(${deg}deg);`); - }); - } - }; + const animate = () => { + const t = options.transition.value / 20; + const step = revealer.reveal_child ? 10 : -10; + for (let i = 0; i < 18; ++i) { + Utils.timeout(t * i, () => { + deg += step; + icon.setCss(`-gtk-icon-transform: rotate(${deg}deg);`); + }); + } + }; - return Widget.Button({ - class_name: "panel-button sub-menu", - connections: [ - [ - items, - (btn) => { - btn.tooltip_text = `${items.value} Items`; - }, - ], - ], - on_clicked: () => { - animate(); - revealer.reveal_child = !revealer.reveal_child; + return Widget.Button({ + class_name: "panel-button sub-menu", + connections: [ + [ + items, + (btn) => { + btn.tooltip_text = `${items.value} Items`; }, - child: icon, - }); + ], + ], + on_clicked: () => { + animate(); + revealer.reveal_child = !revealer.reveal_child; + }, + child: icon, + }); }; /** @@ -52,21 +52,21 @@ const Arrow = (revealer, direction, items) => { * @param {import('types/variable').Variable} o.items */ export default ({ children, direction = "left", items = Variable(0) }) => { - const posStart = direction === "up" || direction === "left"; - const posEnd = direction === "down" || direction === "right"; - const revealer = Widget.Revealer({ - transition: `slide_${direction}`, - child: Widget.Box({ - children, - }), - }); + const posStart = direction === "up" || direction === "left"; + const posEnd = direction === "down" || direction === "right"; + const revealer = Widget.Revealer({ + transition: `slide_${direction}`, + child: Widget.Box({ + children, + }), + }); - return Widget.Box({ - vertical: direction === "up" || direction === "down", - children: [ - posStart && revealer, - Arrow(revealer, direction, items), - posEnd && revealer, - ], - }); + return Widget.Box({ + vertical: direction === "up" || direction === "down", + children: [ + posStart && revealer, + Arrow(revealer, direction, items), + posEnd && revealer, + ], + }); }; diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SysTray.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SysTray.js index c5dfd68f..bb4a29a5 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SysTray.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SysTray.js @@ -5,39 +5,39 @@ import Gdk from "gi://Gdk"; /** @param {import('types/service/systemtray').TrayItem} item */ const SysTrayItem = (item) => - PanelButton({ - class_name: "tray-item", - content: Widget.Icon({ binds: [["icon", item, "icon"]] }), - binds: [["tooltipMarkup", item, "tooltip-markup"]], - setup: (btn) => { - const id = item.menu?.connect("popped-up", (menu) => { - btn.toggleClassName("active"); - menu.connect("notify::visible", (menu) => { - btn.toggleClassName("active", menu.visible); - }); - menu.disconnect(id); - }); - }, - // @ts-expect-error popup_at_widget missing from types? - on_primary_click: (btn) => - item.menu?.popup_at_widget( - btn, - Gdk.Gravity.SOUTH, - Gdk.Gravity.NORTH, - null, - ), + PanelButton({ + class_name: "tray-item", + content: Widget.Icon({ binds: [["icon", item, "icon"]] }), + binds: [["tooltipMarkup", item, "tooltip-markup"]], + setup: (btn) => { + const id = item.menu?.connect("popped-up", (menu) => { + btn.toggleClassName("active"); + menu.connect("notify::visible", (menu) => { + btn.toggleClassName("active", menu.visible); + }); + menu.disconnect(id); + }); + }, + // @ts-expect-error popup_at_widget missing from types? + on_primary_click: (btn) => + item.menu?.popup_at_widget( + btn, + Gdk.Gravity.SOUTH, + Gdk.Gravity.NORTH, + null, + ), - // @ts-expect-error popup_at_widget missing from types? - on_secondary_click: (btn) => - item.menu?.popup_at_widget( - btn, - Gdk.Gravity.SOUTH, - Gdk.Gravity.NORTH, - null, - ), - }); + // @ts-expect-error popup_at_widget missing from types? + on_secondary_click: (btn) => + item.menu?.popup_at_widget( + btn, + Gdk.Gravity.SOUTH, + Gdk.Gravity.NORTH, + null, + ), + }); export default () => - Widget.Box({ - binds: [["children", SystemTray, "items", (i) => i.map(SysTrayItem)]], - }); + Widget.Box({ + binds: [["children", SystemTray, "items", (i) => i.map(SysTrayItem)]], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SystemIndicators.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SystemIndicators.js index 63c49c57..9c8d4045 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SystemIndicators.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/SystemIndicators.js @@ -10,144 +10,136 @@ import HoverRevealer from "../../../misc/HoverRevealer.js"; import icons from "../../../icons.js"; const MicrophoneIndicator = () => - Widget.Icon({ - connections: [ - [ - Audio, - (icon) => { - if (!Audio.microphone) return; + Widget.Icon({ + connections: [ + [ + Audio, + (icon) => { + if (!Audio.microphone) return; - const { muted, low, medium, high } = icons.audio.mic; - if (Audio.microphone.is_muted) return (icon.icon = muted); + const { muted, low, medium, high } = icons.audio.mic; + if (Audio.microphone.is_muted) return (icon.icon = muted); - /** @type {Array<[number, string]>} */ - const cons = [ - [67, high], - [34, medium], - [1, low], - [0, muted], - ]; - icon.icon = - cons.find( - ([n]) => n <= Audio.microphone.volume * 100, - )?.[1] || ""; + /** @type {Array<[number, string]>} */ + const cons = [ + [67, high], + [34, medium], + [1, low], + [0, muted], + ]; + icon.icon = + cons.find(([n]) => n <= Audio.microphone.volume * 100)?.[1] || ""; - icon.visible = - Audio.recorders.length > 0 || Audio.microphone.is_muted; - }, - ], - ], - }); + icon.visible = + Audio.recorders.length > 0 || Audio.microphone.is_muted; + }, + ], + ], + }); const DNDIndicator = () => - Widget.Icon({ - icon: icons.notifications.silent, - binds: [["visible", Notifications, "dnd"]], - }); + Widget.Icon({ + icon: icons.notifications.silent, + binds: [["visible", Notifications, "dnd"]], + }); const BluetoothDevicesIndicator = () => - Widget.Box({ - connections: [ - [ - Bluetooth, - (box) => { - box.children = Bluetooth.connectedDevices.map( - ({ iconName, name }) => - HoverRevealer({ - indicator: Widget.Icon(iconName + "-symbolic"), - child: Widget.Label(name), - }), - ); + Widget.Box({ + connections: [ + [ + Bluetooth, + (box) => { + box.children = Bluetooth.connectedDevices.map(({ iconName, name }) => + HoverRevealer({ + indicator: Widget.Icon(iconName + "-symbolic"), + child: Widget.Label(name), + }), + ); - box.visible = Bluetooth.connectedDevices.length > 0; - }, - "notify::connected-devices", - ], - ], - }); + box.visible = Bluetooth.connectedDevices.length > 0; + }, + "notify::connected-devices", + ], + ], + }); const BluetoothIndicator = () => - Widget.Icon({ - class_name: "bluetooth", - icon: icons.bluetooth.enabled, - binds: [["visible", Bluetooth, "enabled"]], - }); + Widget.Icon({ + class_name: "bluetooth", + icon: icons.bluetooth.enabled, + binds: [["visible", Bluetooth, "enabled"]], + }); const NetworkIndicator = () => - Widget.Icon({ - connections: [ - [ - Network, - (self) => { - const icon = Network[Network.primary || "wifi"]?.iconName; - self.icon = icon || ""; - self.visible = icon; - }, - ], - ], - }); + Widget.Icon({ + connections: [ + [ + Network, + (self) => { + const icon = Network[Network.primary || "wifi"]?.iconName; + self.icon = icon || ""; + self.visible = icon; + }, + ], + ], + }); const AudioIndicator = () => - Widget.Icon({ - connections: [ - [ - Audio, - (icon) => { - if (!Audio.speaker) return; + Widget.Icon({ + connections: [ + [ + Audio, + (icon) => { + if (!Audio.speaker) return; - const { muted, low, medium, high, overamplified } = - icons.audio.volume; - if (Audio.speaker.is_muted) return (icon.icon = muted); + const { muted, low, medium, high, overamplified } = + icons.audio.volume; + if (Audio.speaker.is_muted) return (icon.icon = muted); - /** @type {Array<[number, string]>} */ - const cons = [ - [101, overamplified], - [67, high], - [34, medium], - [1, low], - [0, muted], - ]; - icon.icon = - cons.find( - ([n]) => n <= Audio.speaker.volume * 100, - )?.[1] || ""; - }, - "speaker-changed", - ], - ], - }); + /** @type {Array<[number, string]>} */ + const cons = [ + [101, overamplified], + [67, high], + [34, medium], + [1, low], + [0, muted], + ]; + icon.icon = + cons.find(([n]) => n <= Audio.speaker.volume * 100)?.[1] || ""; + }, + "speaker-changed", + ], + ], + }); export default () => - PanelButton({ - class_name: "quicksettings panel-button", - on_clicked: () => App.toggleWindow("quicksettings"), - on_scroll_up: () => { - Audio.speaker.volume += 0.02; - Indicator.speaker(); - }, - on_scroll_down: () => { - Audio.speaker.volume -= 0.02; - Indicator.speaker(); + PanelButton({ + class_name: "quicksettings panel-button", + on_clicked: () => App.toggleWindow("quicksettings"), + on_scroll_up: () => { + Audio.speaker.volume += 0.02; + Indicator.speaker(); + }, + on_scroll_down: () => { + Audio.speaker.volume -= 0.02; + Indicator.speaker(); + }, + connections: [ + [ + App, + (btn, win, visible) => { + btn.toggleClassName("active", win === "quicksettings" && visible); }, - connections: [ - [ - App, - (btn, win, visible) => { - btn.toggleClassName( - "active", - win === "quicksettings" && visible, - ); - }, - ], - ], - child: Widget.Box({ - children: [ - DNDIndicator(), - BluetoothDevicesIndicator(), - BluetoothIndicator(), - NetworkIndicator(), - AudioIndicator(), - MicrophoneIndicator(), - ], - }), - }); + ], + ], + child: Widget.Box({ + children: [ + DNDIndicator(), + BluetoothDevicesIndicator(), + BluetoothIndicator(), + NetworkIndicator(), + AudioIndicator(), + MicrophoneIndicator(), + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/Workspaces.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/Workspaces.js index 2e3b7fb1..26f7340a 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/Workspaces.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/bar/buttons/Workspaces.js @@ -6,63 +6,60 @@ import { range } from "../../../utils.js"; /** @param {any} arg */ const dispatch = (arg) => () => - Utils.execAsync(`hyprctl dispatch workspace ${arg}`); + Utils.execAsync(`hyprctl dispatch workspace ${arg}`); const Workspaces = () => { - const ws = options.workspaces.value; - return Widget.Box({ - children: range(ws || 20).map((i) => - Widget.Button({ - setup: (btn) => (btn.id = i), - on_clicked: () => dispatch(i), - child: Widget.Label({ - label: `${i}`, - class_name: "indicator", - vpack: "center", - }), - connections: [ - [ - Hyprland, - (btn) => { - btn.toggleClassName( - "active", - Hyprland.active.workspace.id === i, - ); - btn.toggleClassName( - "occupied", - Hyprland.getWorkspace(i)?.windows > 0, - ); - }, - ], - ], - }), - ), - connections: ws - ? [] - : [ - [ - Hyprland.active.workspace, - (box) => - box.children.map((btn) => { - btn.visible = Hyprland.workspaces.some( - (ws) => ws.id === btn.id, - ); - }), - ], - ], - }); + const ws = options.workspaces.value; + return Widget.Box({ + children: range(ws || 20).map((i) => + Widget.Button({ + setup: (btn) => (btn.id = i), + on_clicked: () => dispatch(i), + child: Widget.Label({ + label: `${i}`, + class_name: "indicator", + vpack: "center", + }), + connections: [ + [ + Hyprland, + (btn) => { + btn.toggleClassName("active", Hyprland.active.workspace.id === i); + btn.toggleClassName( + "occupied", + Hyprland.getWorkspace(i)?.windows > 0, + ); + }, + ], + ], + }), + ), + connections: ws + ? [] + : [ + [ + Hyprland.active.workspace, + (box) => + box.children.map((btn) => { + btn.visible = Hyprland.workspaces.some( + (ws) => ws.id === btn.id, + ); + }), + ], + ], + }); }; export default () => - Widget.EventBox({ - class_name: "workspaces panel-button", - child: Widget.Box({ - // its nested like this to keep it consistent with other PanelButton widgets - child: Widget.EventBox({ - on_scroll_up: () => dispatch("m+1"), - on_scroll_down: () => dispatch("m-1"), - class_name: "eventbox", - binds: [["child", options.workspaces, "value", Workspaces]], - }), - }), - }); + Widget.EventBox({ + class_name: "workspaces panel-button", + child: Widget.Box({ + // its nested like this to keep it consistent with other PanelButton widgets + child: Widget.EventBox({ + on_scroll_up: () => dispatch("m+1"), + on_scroll_down: () => dispatch("m-1"), + class_name: "eventbox", + binds: [["child", options.workspaces, "value", Workspaces]], + }), + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/Dashboard.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/Dashboard.js index 8b67a2a6..a8042728 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/Dashboard.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/Dashboard.js @@ -10,26 +10,26 @@ import options from "../../options.js"; * @param {import('../../misc/PopupWindow.js').PopopWindowProps['layout']=} o.layout */ export default () => - PopupWindow({ - name: "dashboard", - connections: [ - [ - options.bar.position, - (self) => { - self.anchor = [options.bar.position.value]; - if (options.bar.position.value === "top") - self.transition = "slide_down"; + PopupWindow({ + name: "dashboard", + connections: [ + [ + options.bar.position, + (self) => { + self.anchor = [options.bar.position.value]; + if (options.bar.position.value === "top") + self.transition = "slide_down"; - if (options.bar.position.value === "bottom") - self.transition = "slide_up"; - }, - ], - ], - child: Widget.Box({ - children: [ - NotificationColumn(), - Widget.Separator({ orientation: 1 }), - DateColumn(), - ], - }), - }); + if (options.bar.position.value === "bottom") + self.transition = "slide_up"; + }, + ], + ], + child: Widget.Box({ + children: [ + NotificationColumn(), + Widget.Separator({ orientation: 1 }), + DateColumn(), + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/DateColumn.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/DateColumn.js index 277d4265..015c79ca 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/DateColumn.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/DateColumn.js @@ -10,66 +10,59 @@ import options from "../../options.js"; * @param {string} unit */ const SysProgress = (type, title, unit) => - Widget.Box({ - class_name: `circular-progress-box ${type}`, - hexpand: true, - binds: [ - [ - "tooltipText", - vars[type], - "value", - (v) => `${title}: ${Math.floor(v * 100)}${unit}`, - ], - ], - child: Widget.CircularProgress({ - hexpand: true, - class_name: `circular-progress ${type}`, - child: Widget.Icon(icons.system[type]), - start_at: 0.75, - binds: [ - ["value", vars[type]], - ["rounded", options.radii, "value", (v) => v > 0], - ], - }), - }); + Widget.Box({ + class_name: `circular-progress-box ${type}`, + hexpand: true, + binds: [ + [ + "tooltipText", + vars[type], + "value", + (v) => `${title}: ${Math.floor(v * 100)}${unit}`, + ], + ], + child: Widget.CircularProgress({ + hexpand: true, + class_name: `circular-progress ${type}`, + child: Widget.Icon(icons.system[type]), + start_at: 0.75, + binds: [ + ["value", vars[type]], + ["rounded", options.radii, "value", (v) => v > 0], + ], + }), + }); export default () => - Widget.Box({ + Widget.Box({ + vertical: true, + class_name: "datemenu vertical", + children: [ + Widget.Box({ + class_name: "clock-box", vertical: true, - class_name: "datemenu vertical", children: [ - Widget.Box({ - class_name: "clock-box", - vertical: true, - children: [ - Clock({ format: "%I:%M" }), - Widget.Label({ - class_name: "uptime", - binds: [ - [ - "label", - vars.uptime, - "value", - (t) => `uptime: ${t}`, - ], - ], - }), - ], - }), - Widget.Box({ - class_name: "calendar", - child: Widget.Calendar({ - hexpand: true, - hpack: "center", - }), - }), - Widget.Box({ - class_name: "system-info horizontal", - children: [ - SysProgress("cpu", "Cpu", "%"), - SysProgress("ram", "Ram", "%"), - SysProgress("temp", "Temperature", "°"), - ], - }), + Clock({ format: "%I:%M" }), + Widget.Label({ + class_name: "uptime", + binds: [["label", vars.uptime, "value", (t) => `uptime: ${t}`]], + }), + ], + }), + Widget.Box({ + class_name: "calendar", + child: Widget.Calendar({ + hexpand: true, + hpack: "center", + }), + }), + Widget.Box({ + class_name: "system-info horizontal", + children: [ + SysProgress("cpu", "Cpu", "%"), + SysProgress("ram", "Ram", "%"), + SysProgress("temp", "Temperature", "°"), ], - }); + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/NotificationColumn.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/NotificationColumn.js index 079bfed4..b920cb96 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/NotificationColumn.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/dashboard/NotificationColumn.js @@ -5,93 +5,86 @@ import Notification from "../../misc/Notification.js"; import { timeout } from "resource:///com/github/Aylur/ags/utils.js"; const ClearButton = () => - Widget.Button({ - on_clicked: () => { - const list = Array.from(Notifications.notifications); - for (let i = 0; i < list.length; i++) - timeout(50 * i, () => list[i]?.close()); - }, - binds: [ - ["sensitive", Notifications, "notifications", (n) => n.length > 0], - ], - child: Widget.Box({ - children: [ - Widget.Label("Clear "), - Widget.Icon({ - binds: [ - [ - "icon", - Notifications, - "notifications", - (n) => - n.length > 0 - ? icons.trash.full - : icons.trash.empty, - ], - ], - }), + Widget.Button({ + on_clicked: () => { + const list = Array.from(Notifications.notifications); + for (let i = 0; i < list.length; i++) + timeout(50 * i, () => list[i]?.close()); + }, + binds: [["sensitive", Notifications, "notifications", (n) => n.length > 0]], + child: Widget.Box({ + children: [ + Widget.Label("Clear "), + Widget.Icon({ + binds: [ + [ + "icon", + Notifications, + "notifications", + (n) => (n.length > 0 ? icons.trash.full : icons.trash.empty), ], + ], }), - }); + ], + }), + }); const Header = () => - Widget.Box({ - class_name: "header", - children: [ - Widget.Label({ label: "Notifications", hexpand: true, xalign: 0 }), - ClearButton(), - ], - }); + Widget.Box({ + class_name: "header", + children: [ + Widget.Label({ label: "Notifications", hexpand: true, xalign: 0 }), + ClearButton(), + ], + }); const NotificationList = () => - Widget.Box({ - vertical: true, - vexpand: true, - connections: [ - [ - Notifications, - (box) => { - box.children = Notifications.notifications - .reverse() - .map(Notification); + Widget.Box({ + vertical: true, + vexpand: true, + connections: [ + [ + Notifications, + (box) => { + box.children = Notifications.notifications + .reverse() + .map(Notification); - box.visible = Notifications.notifications.length > 0; - }, - ], - ], - }); + box.visible = Notifications.notifications.length > 0; + }, + ], + ], + }); const Placeholder = () => - Widget.Box({ - class_name: "placeholder", - vertical: true, - vpack: "center", - hpack: "center", - vexpand: true, - hexpand: true, - children: [ - Widget.Icon(icons.notifications.silent), - Widget.Label("Your inbox is empty"), - ], - binds: [ - ["visible", Notifications, "notifications", (n) => n.length === 0], - ], - }); + Widget.Box({ + class_name: "placeholder", + vertical: true, + vpack: "center", + hpack: "center", + vexpand: true, + hexpand: true, + children: [ + Widget.Icon(icons.notifications.silent), + Widget.Label("Your inbox is empty"), + ], + binds: [["visible", Notifications, "notifications", (n) => n.length === 0]], + }); export default () => - Widget.Box({ - class_name: "notifications", - vertical: true, - children: [ - Header(), - Widget.Scrollable({ - vexpand: true, - class_name: "notification-scrollable", - child: Widget.Box({ - class_name: "notification-list", - vertical: true, - children: [NotificationList(), Placeholder()], - }), - }), - ], - }); + Widget.Box({ + class_name: "notifications", + vertical: true, + children: [ + Header(), + Widget.Scrollable({ + vexpand: true, + class_name: "notification-scrollable", + child: Widget.Box({ + class_name: "notification-list", + vertical: true, + children: [NotificationList(), Placeholder()], + }), + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/notifications/Notifications.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/notifications/Notifications.js index f056c0e4..1ad1b220 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/notifications/Notifications.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/notifications/Notifications.js @@ -6,67 +6,67 @@ import options from "../../options.js"; /** @param {import('types/widgets/revealer').default} parent */ const Popups = (parent) => { - const map = new Map(); + const map = new Map(); - const onDismissed = (_, id, force = false) => { - if (!id || !map.has(id)) return; + const onDismissed = (_, id, force = false) => { + if (!id || !map.has(id)) return; - if (map.get(id).isHovered() && !force) return; + if (map.get(id).isHovered() && !force) return; - if (map.size - 1 === 0) parent.reveal_child = false; + if (map.size - 1 === 0) parent.reveal_child = false; - Utils.timeout(200, () => { - map.get(id)?.destroy(); - map.delete(id); - }); - }; - - /** @param {import('types/widgets/box').default} box */ - const onNotified = (box, id) => { - if (!id || Notifications.dnd) return; + Utils.timeout(200, () => { + map.get(id)?.destroy(); + map.delete(id); + }); + }; - const n = Notifications.getNotification(id); - if (!n) return; + /** @param {import('types/widgets/box').default} box */ + const onNotified = (box, id) => { + if (!id || Notifications.dnd) return; - if (options.notifications.black_list.value.includes(n.app_name || "")) - return; + const n = Notifications.getNotification(id); + if (!n) return; - map.delete(id); - map.set(id, Notification(Notifications.getNotification(id))); - box.children = Array.from(map.values()).reverse(); - Utils.timeout(10, () => { - parent.reveal_child = true; - }); - }; + if (options.notifications.black_list.value.includes(n.app_name || "")) + return; - return Widget.Box({ - vertical: true, - connections: [ - [Notifications, onNotified, "notified"], - [Notifications, onDismissed, "dismissed"], - [Notifications, (box, id) => onDismissed(box, id, true), "closed"], - ], + map.delete(id); + map.set(id, Notification(Notifications.getNotification(id))); + box.children = Array.from(map.values()).reverse(); + Utils.timeout(10, () => { + parent.reveal_child = true; }); + }; + + return Widget.Box({ + vertical: true, + connections: [ + [Notifications, onNotified, "notified"], + [Notifications, onDismissed, "dismissed"], + [Notifications, (box, id) => onDismissed(box, id, true), "closed"], + ], + }); }; /** @param {import('types/widgets/revealer').RevealerProps['transition']} transition */ const PopupList = (transition = "slide_down") => - Widget.Box({ - css: "padding: 1px", - children: [ - Widget.Revealer({ - transition, - setup: (self) => (self.child = Popups(self)), - }), - ], - }); + Widget.Box({ + css: "padding: 1px", + children: [ + Widget.Revealer({ + transition, + setup: (self) => (self.child = Popups(self)), + }), + ], + }); /** @param {number} monitor */ export default (monitor) => - Widget.Window({ - monitor, - class_name: "notifications", - name: `notifications${monitor}`, - binds: [["anchor", options.notifications.position]], - child: PopupList(), - }); + Widget.Window({ + monitor, + class_name: "notifications", + name: `notifications${monitor}`, + binds: [["anchor", options.notifications.position]], + child: PopupList(), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/PowerMenu.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/PowerMenu.js index 16673478..1fcb7948 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/PowerMenu.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/PowerMenu.js @@ -9,27 +9,24 @@ import ShadedPopup from "./ShadedPopup.js"; * @param {string} label */ const SysButton = (action, label) => - Widget.Button({ - on_clicked: () => PowerMenu.action(action) + Utils.exec(PowerMenu.cmd), - child: Widget.Box({ - vertical: true, - children: [ - Widget.Icon(icons.powermenu[action]), - Widget.Label(label), - ], - }), - }); + Widget.Button({ + on_clicked: () => PowerMenu.action(action) + Utils.exec(PowerMenu.cmd), + child: Widget.Box({ + vertical: true, + children: [Widget.Icon(icons.powermenu[action]), Widget.Label(label)], + }), + }); export default () => - ShadedPopup({ - name: "powermenu", - expand: true, - child: Widget.Box({ - children: [ - SysButton("sleep", "Sleep"), - SysButton("reboot", "Reboot"), - SysButton("logout", "Log Out"), - SysButton("shutdown", "Shutdown"), - ], - }), - }); + ShadedPopup({ + name: "powermenu", + expand: true, + child: Widget.Box({ + children: [ + SysButton("sleep", "Sleep"), + SysButton("reboot", "Reboot"), + SysButton("logout", "Log Out"), + SysButton("shutdown", "Shutdown"), + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/ShadedPopup.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/ShadedPopup.js index 43c49baa..0e7f4bf6 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/ShadedPopup.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/powermenu/ShadedPopup.js @@ -3,14 +3,12 @@ import Widget from "resource:///com/github/Aylur/ags/widget.js"; /** @param {string} windowName */ const Padding = (windowName) => - Widget.EventBox({ - class_name: "padding", - hexpand: true, - vexpand: true, - connections: [ - ["button-press-event", () => App.toggleWindow(windowName)], - ], - }); + Widget.EventBox({ + class_name: "padding", + hexpand: true, + vexpand: true, + connections: [["button-press-event", () => App.toggleWindow(windowName)]], + }); /** * @param {import('types/widgets/window').WindowProps & { @@ -19,26 +17,26 @@ const Padding = (windowName) => * }} o */ export default ({ name, child, ...rest }) => - Widget.Window({ - ...rest, - class_names: ["popup-window", name], - name, - visible: false, - popup: true, - focusable: true, - setup() { - child.toggleClassName("window-content"); - }, - child: Widget.CenterBox({ - class_name: "shader", - css: "min-width: 5000px; min-height: 3000px;", - children: [ - Padding(name), - Widget.CenterBox({ - vertical: true, - children: [Padding(name), child, Padding(name)], - }), - Padding(name), - ], + Widget.Window({ + ...rest, + class_names: ["popup-window", name], + name, + visible: false, + popup: true, + focusable: true, + setup() { + child.toggleClassName("window-content"); + }, + child: Widget.CenterBox({ + class_name: "shader", + css: "min-width: 5000px; min-height: 3000px;", + children: [ + Padding(name), + Widget.CenterBox({ + vertical: true, + children: [Padding(name), child, Padding(name)], }), - }); + Padding(name), + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/QuickSettings.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/QuickSettings.js index ef5e11db..ca8e952c 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/QuickSettings.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/QuickSettings.js @@ -12,62 +12,59 @@ import options from "../../options.js"; import PopupWindow from "../../misc/PopupWindow.js"; const Row = (toggles = [], menus = []) => - Widget.Box({ - vertical: true, - children: [ - Widget.Box({ - class_name: "row horizontal", - children: toggles, - }), - ...menus, - ], - }); + Widget.Box({ + vertical: true, + children: [ + Widget.Box({ + class_name: "row horizontal", + children: toggles, + }), + ...menus, + ], + }); const Homogeneous = (toggles) => - Widget.Box({ - homogeneous: true, - children: toggles, - }); + Widget.Box({ + homogeneous: true, + children: toggles, + }); export default () => - PopupWindow({ - name: "quicksettings", - connections: [ - [ - options.bar.position, - (self) => { - self.anchor = ["right", options.bar.position.value]; - if (options.bar.position.value === "top") - self.transition = "slide_down"; + PopupWindow({ + name: "quicksettings", + connections: [ + [ + options.bar.position, + (self) => { + self.anchor = ["right", options.bar.position.value]; + if (options.bar.position.value === "top") + self.transition = "slide_down"; - if (options.bar.position.value === "bottom") - self.transition = "slide_up"; - }, - ], - ], - child: Widget.Box({ - vertical: true, - children: [ - Header(), - Widget.Box({ - class_name: "sliders-box vertical", - class_name: "slider-box", - vertical: true, - children: [ - Row([Volume()], [SinkSelector(), AppMixer()]), - Microhone(), - Brightness(), - ], - }), - Row( - [Homogeneous([NetworkToggle(), BluetoothToggle()]), DND()], - [WifiSelection(), BluetoothDevices()], - ), - Row( - [Homogeneous([ThemeToggle()]), MicMute()], - [ThemeSelector()], - ), - Media(), - ], + if (options.bar.position.value === "bottom") + self.transition = "slide_up"; + }, + ], + ], + child: Widget.Box({ + vertical: true, + children: [ + Header(), + Widget.Box({ + class_name: "sliders-box vertical", + class_name: "slider-box", + vertical: true, + children: [ + Row([Volume()], [SinkSelector(), AppMixer()]), + Microhone(), + Brightness(), + ], }), - }); + Row( + [Homogeneous([NetworkToggle(), BluetoothToggle()]), DND()], + [WifiSelection(), BluetoothDevices()], + ), + Row([Homogeneous([ThemeToggle()]), MicMute()], [ThemeSelector()]), + Media(), + ], + }), + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/ToggleButton.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/ToggleButton.js index ddb2a8cb..f7ce915e 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/ToggleButton.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/ToggleButton.js @@ -7,8 +7,8 @@ import icons from "../../icons.js"; /** name of the currently opened menu */ export const opened = Variable(""); App.connect("window-toggled", (_, name, visible) => { - if (name === "quicksettings" && !visible) - Utils.timeout(500, () => (opened.value = "")); + if (name === "quicksettings" && !visible) + Utils.timeout(500, () => (opened.value = "")); }); /** @@ -16,39 +16,37 @@ App.connect("window-toggled", (_, name, visible) => { * @param {(() => void) | false=} activate */ export const Arrow = (name, activate) => { - let deg = 0; - let iconOpened = false; - return Widget.Button({ - child: Widget.Icon({ - icon: icons.ui.arrow.right, - connections: [ - [ - opened, - (icon) => { - if ( - (opened.value === name && !iconOpened) || - (opened.value !== name && iconOpened) - ) { - const step = opened.value === name ? 10 : -10; - iconOpened = !iconOpened; - for (let i = 0; i < 9; ++i) { - Utils.timeout(15 * i, () => { - deg += step; - icon.setCss( - `-gtk-icon-transform: rotate(${deg}deg);`, - ); - }); - } - } - }, - ], - ], - }), - on_clicked: () => { - opened.value = opened.value === name ? "" : name; - if (typeof activate === "function") activate(); - }, - }); + let deg = 0; + let iconOpened = false; + return Widget.Button({ + child: Widget.Icon({ + icon: icons.ui.arrow.right, + connections: [ + [ + opened, + (icon) => { + if ( + (opened.value === name && !iconOpened) || + (opened.value !== name && iconOpened) + ) { + const step = opened.value === name ? 10 : -10; + iconOpened = !iconOpened; + for (let i = 0; i < 9; ++i) { + Utils.timeout(15 * i, () => { + deg += step; + icon.setCss(`-gtk-icon-transform: rotate(${deg}deg);`); + }); + } + } + }, + ], + ], + }), + on_clicked: () => { + opened.value = opened.value === name ? "" : name; + if (typeof activate === "function") activate(); + }, + }); }; /** @@ -62,42 +60,42 @@ export const Arrow = (name, activate) => { * @param {[import('gi://GObject').GObject.Object, () => boolean]} o.connection */ export const ArrowToggleButton = ({ - name, - icon, - label, - activate, - deactivate, - activateOnArrow = true, - connection: [service, condition], + name, + icon, + label, + activate, + deactivate, + activateOnArrow = true, + connection: [service, condition], }) => - Widget.Box({ - class_name: "toggle-button", - connections: [ - [ - service, - (box) => { - box.toggleClassName("active", condition()); - }, - ], - ], - children: [ - Widget.Button({ - child: Widget.Box({ - hexpand: true, - children: [icon, label], - }), - on_clicked: () => { - if (condition()) { - deactivate(); - if (opened.value === name) opened.value = ""; - } else { - activate(); - } - }, - }), - Arrow(name, activateOnArrow && activate), - ], - }); + Widget.Box({ + class_name: "toggle-button", + connections: [ + [ + service, + (box) => { + box.toggleClassName("active", condition()); + }, + ], + ], + children: [ + Widget.Button({ + child: Widget.Box({ + hexpand: true, + children: [icon, label], + }), + on_clicked: () => { + if (condition()) { + deactivate(); + if (opened.value === name) opened.value = ""; + } else { + activate(); + } + }, + }), + Arrow(name, activateOnArrow && activate), + ], + }); /** * @param {Object} o @@ -107,22 +105,22 @@ export const ArrowToggleButton = ({ * @param {import('gi://Gtk').Gtk.Widget[]} o.content */ export const Menu = ({ name, icon, title, content }) => - Widget.Revealer({ - transition: "slide_down", - binds: [["reveal-child", opened, "value", (v) => v === name]], - child: Widget.Box({ - class_names: ["menu", name], - vertical: true, - children: [ - Widget.Box({ - class_name: "title horizontal", - children: [icon, title], - }), - Widget.Separator(), - ...content, - ], + Widget.Revealer({ + transition: "slide_down", + binds: [["reveal-child", opened, "value", (v) => v === name]], + child: Widget.Box({ + class_names: ["menu", name], + vertical: true, + children: [ + Widget.Box({ + class_name: "title horizontal", + children: [icon, title], }), - }); + Widget.Separator(), + ...content, + ], + }), + }); /** * @param {Object} o @@ -131,20 +129,20 @@ export const Menu = ({ name, icon, title, content }) => * @param {[import('gi://GObject').GObject.Object, () => boolean]} o.connection */ export const SimpleToggleButton = ({ - icon, - toggle, - connection: [service, condition], + icon, + toggle, + connection: [service, condition], }) => - Widget.Button({ - class_name: "simple-toggle", - connections: [ - [ - service, - (box) => { - box.toggleClassName("active", condition()); - }, - ], - ], - child: icon, - on_clicked: toggle, - }); + Widget.Button({ + class_name: "simple-toggle", + connections: [ + [ + service, + (box) => { + box.toggleClassName("active", condition()); + }, + ], + ], + child: icon, + on_clicked: toggle, + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Bluetooth.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Bluetooth.js index 54624f7c..9375410f 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Bluetooth.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Bluetooth.js @@ -4,96 +4,92 @@ import icons from "../../../icons.js"; import { Menu, ArrowToggleButton } from "../ToggleButton.js"; export const BluetoothToggle = () => - ArrowToggleButton({ - name: "bluetooth", - icon: Widget.Icon({ - connections: [ - [ - Bluetooth, - (icon) => { - icon.icon = Bluetooth.enabled - ? icons.bluetooth.enabled - : icons.bluetooth.disabled; - }, - ], - ], - }), - label: Widget.Label({ - truncate: "end", - connections: [ - [ - Bluetooth, - (label) => { - if (!Bluetooth.enabled) - return (label.label = "Disabled"); + ArrowToggleButton({ + name: "bluetooth", + icon: Widget.Icon({ + connections: [ + [ + Bluetooth, + (icon) => { + icon.icon = Bluetooth.enabled + ? icons.bluetooth.enabled + : icons.bluetooth.disabled; + }, + ], + ], + }), + label: Widget.Label({ + truncate: "end", + connections: [ + [ + Bluetooth, + (label) => { + if (!Bluetooth.enabled) return (label.label = "Disabled"); - if (Bluetooth.connectedDevices.length === 0) - return (label.label = "Not Connected"); + if (Bluetooth.connectedDevices.length === 0) + return (label.label = "Not Connected"); - if (Bluetooth.connectedDevices.length === 1) - return (label.label = - Bluetooth.connectedDevices[0].alias); + if (Bluetooth.connectedDevices.length === 1) + return (label.label = Bluetooth.connectedDevices[0].alias); - label.label = `${Bluetooth.connectedDevices.length} Connected`; - }, - ], - ], - }), - connection: [Bluetooth, () => Bluetooth.enabled], - deactivate: () => (Bluetooth.enabled = false), - activate: () => (Bluetooth.enabled = true), - }); + label.label = `${Bluetooth.connectedDevices.length} Connected`; + }, + ], + ], + }), + connection: [Bluetooth, () => Bluetooth.enabled], + deactivate: () => (Bluetooth.enabled = false), + activate: () => (Bluetooth.enabled = true), + }); const DeviceItem = (device) => - Widget.Box({ - children: [ - Widget.Icon(device.icon_name + "-symbolic"), - Widget.Label(device.name), - Widget.Label({ - label: `${device.battery_percentage}%`, - binds: [ - ["visible", device, "battery-percentage", (p) => p > 0], - ], - }), - Widget.Box({ hexpand: true }), - Widget.Spinner({ - binds: [ - ["active", device, "connecting"], - ["visible", device, "connecting"], - ], - }), - Widget.Switch({ - active: device.connected, - binds: [["visible", device, "connecting", (c) => !c]], - connections: [ - [ - "notify::active", - ({ active }) => { - device.setConnection(active); - }, - ], - ], - }), + Widget.Box({ + children: [ + Widget.Icon(device.icon_name + "-symbolic"), + Widget.Label(device.name), + Widget.Label({ + label: `${device.battery_percentage}%`, + binds: [["visible", device, "battery-percentage", (p) => p > 0]], + }), + Widget.Box({ hexpand: true }), + Widget.Spinner({ + binds: [ + ["active", device, "connecting"], + ["visible", device, "connecting"], + ], + }), + Widget.Switch({ + active: device.connected, + binds: [["visible", device, "connecting", (c) => !c]], + connections: [ + [ + "notify::active", + ({ active }) => { + device.setConnection(active); + }, + ], ], - }); + }), + ], + }); export const BluetoothDevices = () => - Menu({ - name: "bluetooth", - icon: Widget.Icon(icons.bluetooth.disabled), - title: Widget.Label("Bluetooth"), - content: [ - Widget.Box({ - hexpand: true, - vertical: true, - binds: [ - [ - "children", - Bluetooth, - "devices", - (ds) => ds.filter((d) => d.name).map(DeviceItem), - ], - ], - }), + Menu({ + name: "bluetooth", + icon: Widget.Icon(icons.bluetooth.disabled), + title: Widget.Label("Bluetooth"), + content: [ + Widget.Box({ + hexpand: true, + vertical: true, + binds: [ + [ + "children", + Bluetooth, + "devices", + (ds) => ds.filter((d) => d.name).map(DeviceItem), + ], ], - }); + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Brightness.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Brightness.js index 87e2a351..0626bae4 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Brightness.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Brightness.js @@ -3,27 +3,27 @@ import icons from "../../../icons.js"; import Brightness from "../../../services/brightness.js"; const BrightnessSlider = () => - Widget.Slider({ - draw_value: false, - hexpand: true, - binds: [["value", Brightness, "screen"]], - on_change: ({ value }) => (Brightness.screen = value), - }); + Widget.Slider({ + draw_value: false, + hexpand: true, + binds: [["value", Brightness, "screen"]], + on_change: ({ value }) => (Brightness.screen = value), + }); export default () => - Widget.Box({ - children: [ - Widget.Button({ - child: Widget.Icon(icons.brightness.indicator), - binds: [ - [ - "tooltip-text", - Brightness, - "screen", - (v) => `Screen Brightness: ${Math.floor(v * 100)}%`, - ], - ], - }), - BrightnessSlider(), + Widget.Box({ + children: [ + Widget.Button({ + child: Widget.Icon(icons.brightness.indicator), + binds: [ + [ + "tooltip-text", + Brightness, + "screen", + (v) => `Screen Brightness: ${Math.floor(v * 100)}%`, + ], ], - }); + }), + BrightnessSlider(), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/DND.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/DND.js index 3798713d..4c31acd3 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/DND.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/DND.js @@ -4,20 +4,20 @@ import icons from "../../../icons.js"; import { SimpleToggleButton } from "../ToggleButton.js"; export default () => - SimpleToggleButton({ - icon: Widget.Icon({ - connections: [ - [ - Notifications, - (icon) => { - icon.icon = Notifications.dnd - ? icons.notifications.silent - : icons.notifications.noisy; - }, - "notify::dnd", - ], - ], - }), - toggle: () => (Notifications.dnd = !Notifications.dnd), - connection: [Notifications, () => Notifications.dnd], - }); + SimpleToggleButton({ + icon: Widget.Icon({ + connections: [ + [ + Notifications, + (icon) => { + icon.icon = Notifications.dnd + ? icons.notifications.silent + : icons.notifications.noisy; + }, + "notify::dnd", + ], + ], + }), + toggle: () => (Notifications.dnd = !Notifications.dnd), + connection: [Notifications, () => Notifications.dnd], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Header.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Header.js index be1a1f99..1a3bc94a 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Header.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Header.js @@ -8,101 +8,95 @@ import options from "../../../options.js"; import { openSettings } from "../../../settings/theme.js"; export const BatteryProgress = () => - Widget.Box({ - class_name: "battery-progress", + Widget.Box({ + class_name: "battery-progress", + vexpand: true, + binds: [["visible", Battery, "available"]], + connections: [ + [ + Battery, + (w) => { + w.toggleClassName("charging", Battery.charging || Battery.charged); + w.toggleClassName( + "medium", + Battery.percent < options.battery.medium.value, + ); + w.toggleClassName("low", Battery.percent < options.battery.low.value); + w.toggleClassName("half", Battery.percent < 48); + }, + ], + ], + child: Widget.Overlay({ + vexpand: true, + child: Widget.ProgressBar({ + hexpand: true, vexpand: true, - binds: [["visible", Battery, "available"]], connections: [ - [ - Battery, - (w) => { - w.toggleClassName( - "charging", - Battery.charging || Battery.charged, - ); - w.toggleClassName( - "medium", - Battery.percent < options.battery.medium.value, - ); - w.toggleClassName( - "low", - Battery.percent < options.battery.low.value, - ); - w.toggleClassName("half", Battery.percent < 48); - }, - ], + [ + Battery, + (progress) => { + progress.fraction = Battery.percent / 100; + }, + ], ], - child: Widget.Overlay({ - vexpand: true, - child: Widget.ProgressBar({ - hexpand: true, - vexpand: true, - connections: [ - [ - Battery, - (progress) => { - progress.fraction = Battery.percent / 100; - }, - ], - ], - }), - overlays: [ - Widget.Label({ - connections: [ - [ - Battery, - (l) => { - l.label = - Battery.charging || Battery.charged - ? icons.battery.charging - : `${Battery.percent}%`; - }, - ], - ], - }), + }), + overlays: [ + Widget.Label({ + connections: [ + [ + Battery, + (l) => { + l.label = + Battery.charging || Battery.charged + ? icons.battery.charging + : `${Battery.percent}%`; + }, ], + ], }), - }); + ], + }), + }); export default () => - Widget.Box({ - class_name: "header horizontal", + Widget.Box({ + class_name: "header horizontal", + children: [ + Avatar(), + Widget.Box({ + class_name: "system-box", + vertical: true, + hexpand: true, children: [ - Avatar(), - Widget.Box({ - class_name: "system-box", - vertical: true, + Widget.Box({ + children: [ + Widget.Button({ + vpack: "center", + on_clicked: openSettings, + child: Widget.Icon(icons.ui.settings), + }), + Widget.Label({ + class_name: "uptime", hexpand: true, - children: [ - Widget.Box({ - children: [ - Widget.Button({ - vpack: "center", - on_clicked: openSettings, - child: Widget.Icon(icons.ui.settings), - }), - Widget.Label({ - class_name: "uptime", - hexpand: true, - vpack: "center", - connections: [ - [ - uptime, - (label) => { - label.label = `uptime: ${uptime.value}`; - }, - ], - ], - }), - Widget.Button({ - vpack: "center", - on_clicked: () => PowerMenu.action("shutdown"), - child: Widget.Icon(icons.powermenu.shutdown), - }), - ], - }), - BatteryProgress(), + vpack: "center", + connections: [ + [ + uptime, + (label) => { + label.label = `uptime: ${uptime.value}`; + }, + ], ], - }), + }), + Widget.Button({ + vpack: "center", + on_clicked: () => PowerMenu.action("shutdown"), + child: Widget.Icon(icons.powermenu.shutdown), + }), + ], + }), + BatteryProgress(), ], - }); + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Media.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Media.js index 28eeca9a..996c88f9 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Media.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Media.js @@ -5,107 +5,102 @@ import options from "../../../options.js"; /** @param {import('types/service/mpris').MprisPlayer} player */ const Footer = (player) => - Widget.CenterBox({ - class_name: "footer-box", + Widget.CenterBox({ + class_name: "footer-box", + children: [ + Widget.Box({ + class_name: "position", children: [ - Widget.Box({ - class_name: "position", - children: [ - mpris.PositionLabel(player), - mpris.Slash(player), - mpris.LengthLabel(player), - ], - }), - Widget.Box({ - class_name: "controls", - children: [ - mpris.ShuffleButton(player), - mpris.PreviousButton(player), - mpris.PlayPauseButton(player), - mpris.NextButton(player), - mpris.LoopButton(player), - ], - }), - mpris.PlayerIcon(player, { - symbolic: false, - hexpand: true, - hpack: "end", - }), + mpris.PositionLabel(player), + mpris.Slash(player), + mpris.LengthLabel(player), ], - }); + }), + Widget.Box({ + class_name: "controls", + children: [ + mpris.ShuffleButton(player), + mpris.PreviousButton(player), + mpris.PlayPauseButton(player), + mpris.NextButton(player), + mpris.LoopButton(player), + ], + }), + mpris.PlayerIcon(player, { + symbolic: false, + hexpand: true, + hpack: "end", + }), + ], + }); /** @param {import('types/service/mpris').MprisPlayer} player */ const TextBox = (player) => - Widget.Box({ + Widget.Box({ + children: [ + mpris.CoverArt(player, { + hpack: "end", + hexpand: false, + }), + Widget.Box({ + hexpand: true, + vertical: true, + class_name: "labels", children: [ - mpris.CoverArt(player, { - hpack: "end", - hexpand: false, - }), - Widget.Box({ - hexpand: true, - vertical: true, - class_name: "labels", - children: [ - mpris.TitleLabel(player, { - xalign: 0, - justification: "left", - wrap: true, - }), - mpris.ArtistLabel(player, { - xalign: 0, - justification: "left", - wrap: true, - }), - ], - }), + mpris.TitleLabel(player, { + xalign: 0, + justification: "left", + wrap: true, + }), + mpris.ArtistLabel(player, { + xalign: 0, + justification: "left", + wrap: true, + }), ], - }); + }), + ], + }); /** @param {import('types/service/mpris').MprisPlayer} player */ const PlayerBox = (player) => - Widget.Box({ - class_name: `player ${player.name}`, - child: mpris.BlurredCoverArt(player, { - hexpand: true, - child: Widget.Box({ - hexpand: true, - vertical: true, - children: [ - TextBox(player), - mpris.PositionSlider(player), - Footer(player), - ], - }), - }), - }); - -export default () => - Widget.Box({ + Widget.Box({ + class_name: `player ${player.name}`, + child: mpris.BlurredCoverArt(player, { + hexpand: true, + child: Widget.Box({ + hexpand: true, vertical: true, - class_name: "media vertical", - connections: [ - [ - "draw", - (self) => { - self.visible = Mpris.players.length > 0; - }, - ], - ], - binds: [ - [ - "children", - Mpris, - "players", - (ps) => - ps - .filter( - (p) => - !options.mpris.black_list.value.includes( - p.identity, - ), - ) - .map(PlayerBox), - ], + children: [ + TextBox(player), + mpris.PositionSlider(player), + Footer(player), ], - }); + }), + }), + }); + +export default () => + Widget.Box({ + vertical: true, + class_name: "media vertical", + connections: [ + [ + "draw", + (self) => { + self.visible = Mpris.players.length > 0; + }, + ], + ], + binds: [ + [ + "children", + Mpris, + "players", + (ps) => + ps + .filter((p) => !options.mpris.black_list.value.includes(p.identity)) + .map(PlayerBox), + ], + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/MicMute.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/MicMute.js index 03f36470..4c800538 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/MicMute.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/MicMute.js @@ -4,20 +4,20 @@ import icons from "../../../icons.js"; import { SimpleToggleButton } from "../ToggleButton.js"; export default () => - SimpleToggleButton({ - icon: Widget.Icon({ - connections: [ - [ - Audio, - (icon) => { - icon.icon = Audio.microphone?.is_muted - ? icons.audio.mic.muted - : icons.audio.mic.high; - }, - "microphone-changed", - ], - ], - }), - toggle: () => (Audio.microphone.is_muted = !Audio.microphone.is_muted), - connection: [Audio, () => Audio.microphone?.is_muted], - }); + SimpleToggleButton({ + icon: Widget.Icon({ + connections: [ + [ + Audio, + (icon) => { + icon.icon = Audio.microphone?.is_muted + ? icons.audio.mic.muted + : icons.audio.mic.high; + }, + "microphone-changed", + ], + ], + }), + toggle: () => (Audio.microphone.is_muted = !Audio.microphone.is_muted), + connection: [Audio, () => Audio.microphone?.is_muted], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Network.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Network.js index 8deb5a2d..a5b87772 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Network.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Network.js @@ -6,92 +6,86 @@ import Applications from "resource:///com/github/Aylur/ags/service/applications. import icons from "../../../icons.js"; export const NetworkToggle = () => - ArrowToggleButton({ - name: "network", - icon: Widget.Icon({ - connections: [ - [ - Network, - (icon) => { - icon.icon = Network.wifi.icon_name || ""; - }, - ], - ], - }), - label: Widget.Label({ - truncate: "end", - connections: [ - [ - Network, - (label) => { - label.label = Network.wifi.ssid || "Not Connected"; - }, - ], - ], - }), - connection: [Network, () => Network.wifi.enabled], - deactivate: () => (Network.wifi.enabled = false), - activate: () => { - Network.wifi.enabled = true; - Network.wifi.scan(); - }, - }); + ArrowToggleButton({ + name: "network", + icon: Widget.Icon({ + connections: [ + [ + Network, + (icon) => { + icon.icon = Network.wifi.icon_name || ""; + }, + ], + ], + }), + label: Widget.Label({ + truncate: "end", + connections: [ + [ + Network, + (label) => { + label.label = Network.wifi.ssid || "Not Connected"; + }, + ], + ], + }), + connection: [Network, () => Network.wifi.enabled], + deactivate: () => (Network.wifi.enabled = false), + activate: () => { + Network.wifi.enabled = true; + Network.wifi.scan(); + }, + }); export const WifiSelection = () => - Menu({ - name: "network", - icon: Widget.Icon({ - connections: [ - [ - Network, - (icon) => { - icon.icon = Network.wifi.icon_name; - }, - ], - ], - }), - title: Widget.Label("Wifi Selection"), - content: [ - Widget.Box({ - vertical: true, - connections: [ - [ - Network, - (box) => - (box.children = Network.wifi?.access_points.map( - (ap) => - Widget.Button({ - on_clicked: () => - Utils.execAsync( - `nmcli device wifi connect ${ap.bssid}`, - ), - child: Widget.Box({ - children: [ - Widget.Icon(ap.iconName), - Widget.Label(ap.ssid || ""), - ap.active && - Widget.Icon({ - icon: icons.tick, - hexpand: true, - hpack: "end", - }), - ], - }), - }), - )), - ], - ], - }), - Widget.Separator(), - Widget.Button({ - on_clicked: () => - Applications.query("nm-connection-editor")?.[0].launch(), - child: Widget.Box({ + Menu({ + name: "network", + icon: Widget.Icon({ + connections: [ + [ + Network, + (icon) => { + icon.icon = Network.wifi.icon_name; + }, + ], + ], + }), + title: Widget.Label("Wifi Selection"), + content: [ + Widget.Box({ + vertical: true, + connections: [ + [ + Network, + (box) => + (box.children = Network.wifi?.access_points.map((ap) => + Widget.Button({ + on_clicked: () => + Utils.execAsync(`nmcli device wifi connect ${ap.bssid}`), + child: Widget.Box({ children: [ - Widget.Icon(icons.ui.settings), - Widget.Label("Network"), + Widget.Icon(ap.iconName), + Widget.Label(ap.ssid || ""), + ap.active && + Widget.Icon({ + icon: icons.tick, + hexpand: true, + hpack: "end", + }), ], + }), }), - }), + )), + ], ], - }); + }), + Widget.Separator(), + Widget.Button({ + on_clicked: () => + Applications.query("nm-connection-editor")?.[0].launch(), + child: Widget.Box({ + children: [Widget.Icon(icons.ui.settings), Widget.Label("Network")], + }), + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Theme.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Theme.js index f278f866..ffcd6300 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Theme.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Theme.js @@ -6,56 +6,51 @@ import options from "../../../options.js"; import { setTheme, openSettings } from "../../../settings/theme.js"; export const ThemeToggle = () => - ArrowToggleButton({ - name: "theme", - icon: Widget.Label({ binds: [["label", options.theme.icon]] }), - label: Widget.Label({ binds: [["label", options.theme.name]] }), - connection: [opened, () => opened.value === "theme"], - activate: () => opened.setValue("theme"), - activateOnArrow: false, - deactivate: () => {}, - }); + ArrowToggleButton({ + name: "theme", + icon: Widget.Label({ binds: [["label", options.theme.icon]] }), + label: Widget.Label({ binds: [["label", options.theme.name]] }), + connection: [opened, () => opened.value === "theme"], + activate: () => opened.setValue("theme"), + activateOnArrow: false, + deactivate: () => {}, + }); export const ThemeSelector = () => - Menu({ - name: "theme", - icon: Widget.Label({ - binds: [["label", options.theme.icon]], + Menu({ + name: "theme", + icon: Widget.Label({ + binds: [["label", options.theme.icon]], + }), + content: [ + ...themes.map(({ name, icon }) => + Widget.Button({ + on_clicked: () => setTheme(name), + child: Widget.Box({ + children: [ + Widget.Label(icon), + Widget.Label(name), + Widget.Icon({ + icon: icons.tick, + hexpand: true, + hpack: "end", + binds: [ + ["visible", options.theme.name, "value", (v) => v === name], + ], + }), + ], + }), }), - content: [ - ...themes.map(({ name, icon }) => - Widget.Button({ - on_clicked: () => setTheme(name), - child: Widget.Box({ - children: [ - Widget.Label(icon), - Widget.Label(name), - Widget.Icon({ - icon: icons.tick, - hexpand: true, - hpack: "end", - binds: [ - [ - "visible", - options.theme.name, - "value", - (v) => v === name, - ], - ], - }), - ], - }), - }), - ), - Widget.Separator(), - Widget.Button({ - on_clicked: openSettings, - child: Widget.Box({ - children: [ - Widget.Icon(icons.ui.settings), - Widget.Label("Theme Settings"), - ], - }), - }), - ], - }); + ), + Widget.Separator(), + Widget.Button({ + on_clicked: openSettings, + child: Widget.Box({ + children: [ + Widget.Icon(icons.ui.settings), + Widget.Label("Theme Settings"), + ], + }), + }), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Volume.js b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Volume.js index 5b6bac92..260dac16 100644 --- a/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Volume.js +++ b/home/isabel/programs/configs/gui/bars/ags/config/windows/quicksettings/widgets/Volume.js @@ -8,198 +8,193 @@ import { getAudioTypeIcon } from "../../../utils.js"; /** @param {'speaker' | 'microphone'=} type */ const VolumeIndicator = (type = "speaker") => - Widget.Button({ - on_clicked: () => (Audio[type].is_muted = !Audio[type].is_muted), - child: Widget.Icon({ - connections: [ - [ - Audio, - (icon) => { - if (!Audio[type]) return; + Widget.Button({ + on_clicked: () => (Audio[type].is_muted = !Audio[type].is_muted), + child: Widget.Icon({ + connections: [ + [ + Audio, + (icon) => { + if (!Audio[type]) return; - icon.icon = - type === "speaker" - ? getAudioTypeIcon(Audio[type].icon_name || "") - : icons.audio.mic.high; + icon.icon = + type === "speaker" + ? getAudioTypeIcon(Audio[type].icon_name || "") + : icons.audio.mic.high; - icon.tooltip_text = `Volume ${Math.floor( - Audio[type].volume * 100, - )}%`; - }, - `${type}-changed`, - ], - ], - }), - }); + icon.tooltip_text = `Volume ${Math.floor( + Audio[type].volume * 100, + )}%`; + }, + `${type}-changed`, + ], + ], + }), + }); /** @param {'speaker' | 'microphone'=} type */ const VolumeSlider = (type = "speaker") => - Widget.Slider({ - hexpand: true, - draw_value: false, - on_change: ({ value }) => (Audio[type].volume = value), - connections: [ - [ - Audio, - (slider) => { - slider.value = Audio[type]?.volume; - }, - `${type}-changed`, - ], - ], - }); + Widget.Slider({ + hexpand: true, + draw_value: false, + on_change: ({ value }) => (Audio[type].volume = value), + connections: [ + [ + Audio, + (slider) => { + slider.value = Audio[type]?.volume; + }, + `${type}-changed`, + ], + ], + }); export const Volume = () => - Widget.Box({ - children: [ - VolumeIndicator("speaker"), - VolumeSlider("speaker"), - Widget.Box({ - vpack: "center", - child: Arrow("sink-selector"), - }), - Widget.Box({ - vpack: "center", - child: Arrow("app-mixer"), - connections: [ - [ - Audio, - (box) => { - box.visible = Audio.apps.length > 0; - }, - ], - ], - }), + Widget.Box({ + children: [ + VolumeIndicator("speaker"), + VolumeSlider("speaker"), + Widget.Box({ + vpack: "center", + child: Arrow("sink-selector"), + }), + Widget.Box({ + vpack: "center", + child: Arrow("app-mixer"), + connections: [ + [ + Audio, + (box) => { + box.visible = Audio.apps.length > 0; + }, + ], ], - }); + }), + ], + }); export const Microhone = () => - Widget.Box({ - class_name: "slider horizontal", - binds: [["visible", Audio, "recorders", (r) => r.length > 0]], - children: [VolumeIndicator("microphone"), VolumeSlider("microphone")], - }); + Widget.Box({ + class_name: "slider horizontal", + binds: [["visible", Audio, "recorders", (r) => r.length > 0]], + children: [VolumeIndicator("microphone"), VolumeSlider("microphone")], + }); /** @param {import('types/service/audio').Stream} stream */ const MixerItem = (stream) => - Widget.Box({ - hexpand: true, - class_name: "mixer-item horizontal", + Widget.Box({ + hexpand: true, + class_name: "mixer-item horizontal", + children: [ + Widget.Icon({ + binds: [["tooltipText", stream, "name"]], + connections: [ + [ + stream, + (icon) => { + icon.icon = Utils.lookUpIcon(stream.name || "") + ? stream.name || "" + : icons.mpris.fallback; + }, + ], + ], + }), + Widget.Box({ + vertical: true, children: [ - Widget.Icon({ - binds: [["tooltipText", stream, "name"]], - connections: [ - [ - stream, - (icon) => { - icon.icon = Utils.lookUpIcon(stream.name || "") - ? stream.name || "" - : icons.mpris.fallback; - }, - ], - ], - }), - Widget.Box({ - vertical: true, - children: [ - Widget.Label({ - xalign: 0, - truncate: "end", - binds: [["label", stream, "description"]], - }), - Widget.Slider({ - hexpand: true, - draw_value: false, - binds: [["value", stream, "volume"]], - on_change: ({ value }) => (stream.volume = value), - }), - ], - }), - Widget.Label({ - xalign: 1, - connections: [ - [ - stream, - (l) => { - l.label = `${Math.floor(stream.volume * 100)}%`; - }, - ], - ], - }), + Widget.Label({ + xalign: 0, + truncate: "end", + binds: [["label", stream, "description"]], + }), + Widget.Slider({ + hexpand: true, + draw_value: false, + binds: [["value", stream, "volume"]], + on_change: ({ value }) => (stream.volume = value), + }), + ], + }), + Widget.Label({ + xalign: 1, + connections: [ + [ + stream, + (l) => { + l.label = `${Math.floor(stream.volume * 100)}%`; + }, + ], ], - }); + }), + ], + }); /** @param {import('types/service/audio').Stream} stream */ const SinkItem = (stream) => - Widget.Button({ - hexpand: true, - on_clicked: () => (Audio.speaker = stream), - child: Widget.Box({ - children: [ - Widget.Icon({ - icon: getAudioTypeIcon(stream.icon_name || ""), - tooltip_text: stream.icon_name, - }), - Widget.Label( - (stream.description || "").split(" ").slice(0, 4).join(" "), - ), - Widget.Icon({ - icon: icons.tick, - hexpand: true, - hpack: "end", - connections: [ - [ - "draw", - (icon) => { - icon.visible = Audio.speaker === stream; - }, - ], - ], - }), + Widget.Button({ + hexpand: true, + on_clicked: () => (Audio.speaker = stream), + child: Widget.Box({ + children: [ + Widget.Icon({ + icon: getAudioTypeIcon(stream.icon_name || ""), + tooltip_text: stream.icon_name, + }), + Widget.Label( + (stream.description || "").split(" ").slice(0, 4).join(" "), + ), + Widget.Icon({ + icon: icons.tick, + hexpand: true, + hpack: "end", + connections: [ + [ + "draw", + (icon) => { + icon.visible = Audio.speaker === stream; + }, ], + ], }), - }); + ], + }), + }); const SettingsButton = () => - Widget.Button({ - on_clicked: () => Utils.execAsync("pavucontrol"), - hexpand: true, - child: Widget.Box({ - children: [ - Widget.Icon(icons.ui.settings), - Widget.Label("Settings"), - ], - }), - }); + Widget.Button({ + on_clicked: () => Utils.execAsync("pavucontrol"), + hexpand: true, + child: Widget.Box({ + children: [Widget.Icon(icons.ui.settings), Widget.Label("Settings")], + }), + }); export const AppMixer = () => - Menu({ - name: "app-mixer", - icon: FontIcon(icons.audio.mixer), - title: Widget.Label("App Mixer"), - content: [ - Widget.Box({ - vertical: true, - binds: [["children", Audio, "apps", (a) => a.map(MixerItem)]], - }), - Widget.Separator(), - SettingsButton(), - ], - }); + Menu({ + name: "app-mixer", + icon: FontIcon(icons.audio.mixer), + title: Widget.Label("App Mixer"), + content: [ + Widget.Box({ + vertical: true, + binds: [["children", Audio, "apps", (a) => a.map(MixerItem)]], + }), + Widget.Separator(), + SettingsButton(), + ], + }); export const SinkSelector = () => - Menu({ - name: "sink-selector", - icon: Widget.Icon(icons.audio.type.headset), - title: Widget.Label("Sink Selector"), - content: [ - Widget.Box({ - vertical: true, - binds: [ - ["children", Audio, "speakers", (s) => s.map(SinkItem)], - ], - }), - Widget.Separator(), - SettingsButton(), - ], - }); + Menu({ + name: "sink-selector", + icon: Widget.Icon(icons.audio.type.headset), + title: Widget.Label("Sink Selector"), + content: [ + Widget.Box({ + vertical: true, + binds: [["children", Audio, "speakers", (s) => s.map(SinkItem)]], + }), + Widget.Separator(), + SettingsButton(), + ], + }); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/eww.scss b/home/isabel/programs/configs/gui/bars/eww/config/eww.scss index 5087cc38..88a2445f 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/eww.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/eww.scss @@ -26,5 +26,5 @@ @import "./scss/windows/screenshot.scss"; tooltip { - @include tooltip; + @include tooltip; } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/apps.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/apps.js index 1f81d0f2..fe910b6a 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/apps.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/apps.js @@ -3,117 +3,116 @@ import { MkDirectory, APPICON_CACHE_PATH } from "./main.js"; import { Gio, GObject, Gtk } from "./lib.js"; export const Apps = GObject.registerClass( - { - Signals: { sync: {} }, - }, - class Apps extends GObject.Object { - constructor() { - super(); - - this._register(); - } - - get json() { - return this._list; - } - - _iconPath(icon) { - return APPICON_CACHE_PATH + icon + ".png"; - } - - init() { - this._initIcons(); - this.Query(""); - } - - _initIcons() { - MkDirectory(); - let icons = []; - Gio.AppInfo.get_all().forEach((app) => { - if (!app.should_show() || !app.get_icon()) return; - if (typeof app.get_icon().get_names !== "function") return; - app?.get_icon() - ?.get_names() - .forEach((icon) => icons.push(icon)); - }); - - icons.forEach((icon) => { - if (icon.includes("-symbolic")) return; - let iconInfo = Gtk.IconTheme.get_default().lookup_by_gicon( - Gio.Icon.new_for_string(icon), - 128, - null, - ); - - if (!iconInfo) return; - - let output_stream = Gio.File.new_for_path( - this._iconPath(icon), - ).replace(null, false, Gio.FileCreateFlags.NONE, null); - - iconInfo - .load_icon() - .save_to_streamv(output_stream, "png", null, null, null); - - output_stream.close(null); - }); - } - - _appIconName(app) { - if (!app.get_icon()) return ""; - - if (typeof app.get_icon().get_names !== "function") return ""; - - let name = app.get_icon().get_names()[0]; - return name ? this._iconPath(name) : ""; - } - - Query(search) { - let apps = Gio.AppInfo.get_all(); - let list = []; - apps.forEach((app) => { - if (!app.should_show()) return; - if (app.get_name()?.toLowerCase().includes(search)) - list.push(app); - else if (app.get_id()?.toLowerCase().includes(search)) - list.push(app); - else if (app.get_executable()?.toLowerCase().includes(search)) - list.push(app); - else if (app.get_description()?.toLowerCase().includes(search)) - list.push(app); - }); - - let outList = []; - list.forEach((app) => { - outList.push({ - name: app.get_name(), - desktop: app.get_id(), - description: app.get_description(), - icon: this._appIconName(app), - }); - }); - this._list = outList; - this.emit("sync"); - } - - _register() { - Gio.bus_own_name( - Gio.BusType.SESSION, - "com.github.isabel.host", - Gio.BusNameOwnerFlags.NONE, - (connection, _) => { - this._dbus = Gio.DBusExportedObject.wrapJSObject( - ApplicationsIFace, - this, - ); - this._dbus.export( - connection, - "/com/github/isabel/applications", - ); - }, - null, - null, - ); - } - }, + { + Signals: { sync: {} }, + }, + class Apps extends GObject.Object { + constructor() { + super(); + + this._register(); + } + + get json() { + return this._list; + } + + _iconPath(icon) { + return APPICON_CACHE_PATH + icon + ".png"; + } + + init() { + this._initIcons(); + this.Query(""); + } + + _initIcons() { + MkDirectory(); + let icons = []; + Gio.AppInfo.get_all().forEach((app) => { + if (!app.should_show() || !app.get_icon()) return; + if (typeof app.get_icon().get_names !== "function") return; + app + ?.get_icon() + ?.get_names() + .forEach((icon) => icons.push(icon)); + }); + + icons.forEach((icon) => { + if (icon.includes("-symbolic")) return; + let iconInfo = Gtk.IconTheme.get_default().lookup_by_gicon( + Gio.Icon.new_for_string(icon), + 128, + null, + ); + + if (!iconInfo) return; + + let output_stream = Gio.File.new_for_path(this._iconPath(icon)).replace( + null, + false, + Gio.FileCreateFlags.NONE, + null, + ); + + iconInfo + .load_icon() + .save_to_streamv(output_stream, "png", null, null, null); + + output_stream.close(null); + }); + } + + _appIconName(app) { + if (!app.get_icon()) return ""; + + if (typeof app.get_icon().get_names !== "function") return ""; + + let name = app.get_icon().get_names()[0]; + return name ? this._iconPath(name) : ""; + } + + Query(search) { + let apps = Gio.AppInfo.get_all(); + let list = []; + apps.forEach((app) => { + if (!app.should_show()) return; + if (app.get_name()?.toLowerCase().includes(search)) list.push(app); + else if (app.get_id()?.toLowerCase().includes(search)) list.push(app); + else if (app.get_executable()?.toLowerCase().includes(search)) + list.push(app); + else if (app.get_description()?.toLowerCase().includes(search)) + list.push(app); + }); + + let outList = []; + list.forEach((app) => { + outList.push({ + name: app.get_name(), + desktop: app.get_id(), + description: app.get_description(), + icon: this._appIconName(app), + }); + }); + this._list = outList; + this.emit("sync"); + } + + _register() { + Gio.bus_own_name( + Gio.BusType.SESSION, + "com.github.isabel.host", + Gio.BusNameOwnerFlags.NONE, + (connection, _) => { + this._dbus = Gio.DBusExportedObject.wrapJSObject( + ApplicationsIFace, + this, + ); + this._dbus.export(connection, "/com/github/isabel/applications"); + }, + null, + null, + ); + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/battery.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/battery.js index f1b66690..1035e735 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/battery.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/battery.js @@ -2,76 +2,62 @@ import { GObject, Gio, UPowerGlib } from "./lib.js"; import { PowerManagerProxy } from "./dbus.js"; export const Battery = GObject.registerClass( - { - Signals: { sync: {} }, - }, - class Battery extends GObject.Object { - constructor() { - super(); - - this._json = {}; - this._proxy = new PowerManagerProxy( - Gio.DBus.system, - "org.freedesktop.UPower", - "/org/freedesktop/UPower/devices/DisplayDevice", - () => { - this._proxy.connect("g-properties-changed", () => - this._sync(), - ); - this._sync(); - }, - ); - } - - get json() { - return this._json; - } - - _sync() { - if (!this._proxy.IsPresent) return { available: false }; - - let percent = this._proxy.Percentage; - let charging = - this._proxy.State === UPowerGlib.DeviceState.CHARGING; - let charged = - this._proxy.State === UPowerGlib.DeviceState.FULLY_CHARGED || - (this._proxy.State === UPowerGlib.DeviceState.CHARGING && - percent === 100); - - let icons = ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]; - let charging_icons = [ - "󰢜", - "󰂆", - "󰂇", - "󰂈", - "󰢝", - "󰂉", - "󰢞", - "󰂊", - "󰂋", - "󰂅", - ]; - let i = Math.round(percent / 10) - 1; - if (i < 0) i = 0; - - let icon; - if (charged) icon = "󰂄"; - else if (charging) icon = charging_icons[i]; - else if (percent < 10) icon = "󱃍"; - else icon = icons[i]; - - let state = ""; - if (charged) state = "charged"; - else if (charging) state = "charging"; - else if (percent < 30) state = "low"; - - this._json = { - available: true, - icon, - percent, - state, - }; - this.emit("sync"); - } - }, + { + Signals: { sync: {} }, + }, + class Battery extends GObject.Object { + constructor() { + super(); + + this._json = {}; + this._proxy = new PowerManagerProxy( + Gio.DBus.system, + "org.freedesktop.UPower", + "/org/freedesktop/UPower/devices/DisplayDevice", + () => { + this._proxy.connect("g-properties-changed", () => this._sync()); + this._sync(); + }, + ); + } + + get json() { + return this._json; + } + + _sync() { + if (!this._proxy.IsPresent) return { available: false }; + + let percent = this._proxy.Percentage; + let charging = this._proxy.State === UPowerGlib.DeviceState.CHARGING; + let charged = + this._proxy.State === UPowerGlib.DeviceState.FULLY_CHARGED || + (this._proxy.State === UPowerGlib.DeviceState.CHARGING && + percent === 100); + + let icons = ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"]; + let charging_icons = ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"]; + let i = Math.round(percent / 10) - 1; + if (i < 0) i = 0; + + let icon; + if (charged) icon = "󰂄"; + else if (charging) icon = charging_icons[i]; + else if (percent < 10) icon = "󱃍"; + else icon = icons[i]; + + let state = ""; + if (charged) state = "charged"; + else if (charging) state = "charging"; + else if (percent < 30) state = "low"; + + this._json = { + available: true, + icon, + percent, + state, + }; + this.emit("sync"); + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/bluetooth.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/bluetooth.js index f1d7d551..a3814454 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/bluetooth.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/bluetooth.js @@ -1,122 +1,117 @@ import { GObject, GnomeBluetooth } from "./lib.js"; const STATES = { - [GnomeBluetooth.AdapterState.ABSENT]: "absent", - [GnomeBluetooth.AdapterState.ON]: "on", - [GnomeBluetooth.AdapterState.TURNING_ON]: "on", - [GnomeBluetooth.AdapterState.OFF]: "off", - [GnomeBluetooth.AdapterState.TURNING_OFF]: "off", + [GnomeBluetooth.AdapterState.ABSENT]: "absent", + [GnomeBluetooth.AdapterState.ON]: "on", + [GnomeBluetooth.AdapterState.TURNING_ON]: "on", + [GnomeBluetooth.AdapterState.OFF]: "off", + [GnomeBluetooth.AdapterState.TURNING_OFF]: "off", }; const ICONS = { - absent: "󰂲", - off: "󰂲", - on: "󰂯", - "audio-headset": "󰋋", + absent: "󰂲", + off: "󰂲", + on: "󰂯", + "audio-headset": "󰋋", }; export const Bluetooth = GObject.registerClass( - { - Signals: { sync: {} }, - }, - class Bluetooth extends GObject.Object { - constructor() { - super(); - - this._json = {}; - this._devices = new Map(); - this._connections = new Map(); - this._client = new GnomeBluetooth.Client(); - this._client.connect( - "notify::default-adapter-state", - this._sync.bind(this), - ); - this._client.connect("device-added", this._deviceAdded.bind(this)); - this._client.connect( - "device-removed", - this._deviceRemoved.bind(this), - ); - this._getDevices().forEach((device) => - this._deviceAdded(_, device), - ); - this._sync(); - } - - get json() { - return this._json; - } - - _deviceAdded(_, device) { - if (this._devices.has(device.address)) return; - - let connections = []; - [ - "address", - "alias", - "battery-level", - "battery-percentage", - "connected", - "icon", - "name", - "paired", - "truested", - ].forEach((prop) => - connections.push( - device.connect(`notify::${prop}`, this._sync.bind(this)), - ), - ); - this._connections.set(device.address, connections); - - this._devices.set(device.address, device); - this._sync(); - } - - _deviceRemoved(_, device) { - if (!this._devices.has(device.address)) return; - - this._connections - .get(device.address) - .forEach((id) => device.disconnect(id)); - this._connections.delete(device.address); - this._devices.delete(device.address); - this._sync(); - } - - _getDevices() { - let devices = []; - const deviceStore = this._client.get_devices(); - - for (let i = 0; i < deviceStore.get_n_items(); ++i) { - const device = deviceStore.get_item(i); - - if (device.paired || device.trusted) devices.push(device); - } - - return devices; - } - - _sync() { - this._json.state = STATES[this._client.default_adapter_state]; - this._json.icon = ICONS[this._json.state]; - this._json.connected_devices = []; - this._json.devices = []; - for (const [_, device] of this._devices) { - let item = { - address: device.address, - alias: device.alias, - battery_level: device.battery_level, - battery_percentage: device.battery_percentage, - connected: device.connected, - icon: ICONS[device.icon], - name: device.name, - paired: device.paired, - trusted: device.trusted, - }; - this._json.devices.push(item); - if (device.connected) this._json.connected_devices.push(item); - } - - this.emit("sync"); - } - }, + { + Signals: { sync: {} }, + }, + class Bluetooth extends GObject.Object { + constructor() { + super(); + + this._json = {}; + this._devices = new Map(); + this._connections = new Map(); + this._client = new GnomeBluetooth.Client(); + this._client.connect( + "notify::default-adapter-state", + this._sync.bind(this), + ); + this._client.connect("device-added", this._deviceAdded.bind(this)); + this._client.connect("device-removed", this._deviceRemoved.bind(this)); + this._getDevices().forEach((device) => this._deviceAdded(_, device)); + this._sync(); + } + + get json() { + return this._json; + } + + _deviceAdded(_, device) { + if (this._devices.has(device.address)) return; + + let connections = []; + [ + "address", + "alias", + "battery-level", + "battery-percentage", + "connected", + "icon", + "name", + "paired", + "truested", + ].forEach((prop) => + connections.push( + device.connect(`notify::${prop}`, this._sync.bind(this)), + ), + ); + this._connections.set(device.address, connections); + + this._devices.set(device.address, device); + this._sync(); + } + + _deviceRemoved(_, device) { + if (!this._devices.has(device.address)) return; + + this._connections + .get(device.address) + .forEach((id) => device.disconnect(id)); + this._connections.delete(device.address); + this._devices.delete(device.address); + this._sync(); + } + + _getDevices() { + let devices = []; + const deviceStore = this._client.get_devices(); + + for (let i = 0; i < deviceStore.get_n_items(); ++i) { + const device = deviceStore.get_item(i); + + if (device.paired || device.trusted) devices.push(device); + } + + return devices; + } + + _sync() { + this._json.state = STATES[this._client.default_adapter_state]; + this._json.icon = ICONS[this._json.state]; + this._json.connected_devices = []; + this._json.devices = []; + for (const [_, device] of this._devices) { + let item = { + address: device.address, + alias: device.alias, + battery_level: device.battery_level, + battery_percentage: device.battery_percentage, + connected: device.connected, + icon: ICONS[device.icon], + name: device.name, + paired: device.paired, + trusted: device.trusted, + }; + this._json.devices.push(item); + if (device.connected) this._json.connected_devices.push(item); + } + + this.emit("sync"); + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/dbus.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/dbus.js index 30c6bbe8..0d403ed5 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/dbus.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/dbus.js @@ -1,7 +1,7 @@ import { Gio } from "./lib.js"; export const MprisPlayerProxy = Gio.DBusProxy.makeProxyWrapper( - ` + ` @@ -19,7 +19,7 @@ export const MprisPlayerProxy = Gio.DBusProxy.makeProxyWrapper( ); export const DBusProxy = Gio.DBusProxy.makeProxyWrapper( - ` + ` @@ -34,7 +34,7 @@ export const DBusProxy = Gio.DBusProxy.makeProxyWrapper( ); export const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper( - ` + ` diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/lib.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/lib.js index 3b8727d3..a11f995b 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/lib.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/lib.js @@ -8,12 +8,12 @@ imports.gi.versions.NM = "1.0"; imports.gi.versions.GdkPixbuf = "2.0"; export const { - Gtk, - Gio, - GLib, - GObject, - UPowerGlib, - GnomeBluetooth, - NM, - GdkPixbuf, + Gtk, + Gio, + GLib, + GObject, + UPowerGlib, + GnomeBluetooth, + NM, + GdkPixbuf, } = imports.gi; diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/main.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/main.js index 9a09cb8c..89cd4155 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/main.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/main.js @@ -15,150 +15,142 @@ export const NOTIFICATIONS_CACHE_PATH = CACHE_PATH + "notifications/"; export const APPICON_CACHE_PATH = CACHE_PATH + "apps/"; export const PlayerIcons = { - deafult: "", //icon broken - spotify: "", - chromium: "", - mpv: "", + deafult: "", //icon broken + spotify: "", + chromium: "", + mpv: "", }; export function MkDirectory() { - [ - CACHE_PATH, - MEDIA_CACHE_PATH, - NOTIFICATIONS_CACHE_PATH, - APPICON_CACHE_PATH, - ].forEach((path) => { - if (!GLib.file_test(path, GLib.FileTest.EXISTS)) - Gio.File.new_for_path(path).make_directory(null); - }); + [ + CACHE_PATH, + MEDIA_CACHE_PATH, + NOTIFICATIONS_CACHE_PATH, + APPICON_CACHE_PATH, + ].forEach((path) => { + if (!GLib.file_test(path, GLib.FileTest.EXISTS)) + Gio.File.new_for_path(path).make_directory(null); + }); } const App = GObject.registerClass( - class App extends Gtk.Application { - constructor({ eww, file, stdout, fg_color }) { - super({ - application_id: "com.github.isabel.host", - flags: Gio.ApplicationFlags.DEFAULT_FLAGS, - }); - - MkDirectory(); - - this._eww = eww; - this._file = file; - this._stdout = stdout; - this._json = {}; - - this._notifications = new Notifications(fg_color); - this._battery = new Battery(); - this._network = new Network(); - this._bluetooth = new Bluetooth(); - this._media = new Media(); - this._apps = new Apps(); - - this.run(null); - } - - vfunc_activate() { - this.hold(); - - [ - "notifications", - "battery", - "network", - "bluetooth", - "apps", - "media", - ].forEach((m) => this._output(this[`_${m}`].json, m)); - - this._notifications.connect("sync", (o) => - this._output(o.json, "notifications"), - ); - this._battery.connect("sync", (o) => - this._output(o.json, "battery"), - ); - this._network.connect("sync", (o) => - this._output(o.json, "network"), - ); - this._bluetooth.connect("sync", (o) => - this._output(o.json, "bluetooth"), - ); - this._apps.connect("sync", (o) => this._output(o.json, "apps")); - this._apps.init(); - - this._media.connect("sync", (o) => this._output(o.json, "media")); - this._media.connect("positions", (o) => - this._output(o.positions, "media_positions"), - ); - GLib.timeout_add(GLib.PRIORITY_DEFAULT, TICK_INTERVAL, () => - this._media.getPositions(), - ); - } - - _output(json, name) { - if (!json) return; - if (this._file) { - const file = Gio.File.new_for_path(CACHE_PATH + name + ".json"); - - if (!GLib.file_test(file.get_path(), GLib.FileTest.EXISTS)) - file.create(Gio.FileCreateFlags.NONE, null); - - file.replace_contents( - JSON.stringify(json, null, 2), - null, - false, - Gio.FileCreateFlags.REPLACE_DESTINATION, - null, - ); - } - - if (this._eww) { - GLib.spawn_command_line_async( - `eww update ${name}=${JSON.stringify( - JSON.stringify(json), - )}`, - ); - } - - if (this._stdout) { - this._json[name] = json; - print(JSON.stringify(this._json, null, 2)); - } - } - }, + class App extends Gtk.Application { + constructor({ eww, file, stdout, fg_color }) { + super({ + application_id: "com.github.isabel.host", + flags: Gio.ApplicationFlags.DEFAULT_FLAGS, + }); + + MkDirectory(); + + this._eww = eww; + this._file = file; + this._stdout = stdout; + this._json = {}; + + this._notifications = new Notifications(fg_color); + this._battery = new Battery(); + this._network = new Network(); + this._bluetooth = new Bluetooth(); + this._media = new Media(); + this._apps = new Apps(); + + this.run(null); + } + + vfunc_activate() { + this.hold(); + + [ + "notifications", + "battery", + "network", + "bluetooth", + "apps", + "media", + ].forEach((m) => this._output(this[`_${m}`].json, m)); + + this._notifications.connect("sync", (o) => + this._output(o.json, "notifications"), + ); + this._battery.connect("sync", (o) => this._output(o.json, "battery")); + this._network.connect("sync", (o) => this._output(o.json, "network")); + this._bluetooth.connect("sync", (o) => this._output(o.json, "bluetooth")); + this._apps.connect("sync", (o) => this._output(o.json, "apps")); + this._apps.init(); + + this._media.connect("sync", (o) => this._output(o.json, "media")); + this._media.connect("positions", (o) => + this._output(o.positions, "media_positions"), + ); + GLib.timeout_add(GLib.PRIORITY_DEFAULT, TICK_INTERVAL, () => + this._media.getPositions(), + ); + } + + _output(json, name) { + if (!json) return; + if (this._file) { + const file = Gio.File.new_for_path(CACHE_PATH + name + ".json"); + + if (!GLib.file_test(file.get_path(), GLib.FileTest.EXISTS)) + file.create(Gio.FileCreateFlags.NONE, null); + + file.replace_contents( + JSON.stringify(json, null, 2), + null, + false, + Gio.FileCreateFlags.REPLACE_DESTINATION, + null, + ); + } + + if (this._eww) { + GLib.spawn_command_line_async( + `eww update ${name}=${JSON.stringify(JSON.stringify(json))}`, + ); + } + + if (this._stdout) { + this._json[name] = json; + print(JSON.stringify(this._json, null, 2)); + } + } + }, ); function parseArgs(argv) { - let args = {}; - for (let i = 0; i < argv.length; ++i) { - switch (argv[i]) { - case "--help": - args.help = true; - break; - case "--eww": - args.eww = true; - break; - case "--file": - args.file = true; - break; - case "--stdout": - args.stdout = true; - break; - case "--fg-color": - args.fg_color = argv[i++]; - break; - default: - break; - } + let args = {}; + for (let i = 0; i < argv.length; ++i) { + switch (argv[i]) { + case "--help": + args.help = true; + break; + case "--eww": + args.eww = true; + break; + case "--file": + args.file = true; + break; + case "--stdout": + args.stdout = true; + break; + case "--fg-color": + args.fg_color = argv[i++]; + break; + default: + break; } - return args; + } + return args; } export function main(argv) { - let { help, eww, file, stdout, fg_color } = parseArgs(argv); - if ((!eww && !file && !stdout) || help) { - print("Usage:", argv[0], "[--eww] [--file] [--stdout]"); - return; - } - print("Cache directory:", CACHE_PATH); - new App({ eww, file, stdout, fg_color }); + let { help, eww, file, stdout, fg_color } = parseArgs(argv); + if ((!eww && !file && !stdout) || help) { + print("Usage:", argv[0], "[--eww] [--file] [--stdout]"); + return; + } + print("Cache directory:", CACHE_PATH); + new App({ eww, file, stdout, fg_color }); } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/media.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/media.js index 3dc7712e..9c66ed3a 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/media.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/media.js @@ -1,301 +1,287 @@ import { MprisPlayerProxy, DBusProxy } from "./dbus.js"; import { - PlayerIcons, - PREFERRED_PLAYER, - MEDIA_CACHE_PATH, - MkDirectory, + PlayerIcons, + PREFERRED_PLAYER, + MEDIA_CACHE_PATH, + MkDirectory, } from "./main.js"; import { GObject, Gio, GLib } from "./lib.js"; function _lengthStr(length) { - let min = Math.floor(length / 60); - let sec0 = Math.floor(length % 60) < 10 ? "0" : ""; - let sec = Math.floor(length % 60); - return `${min}:${sec0}${sec}`; + let min = Math.floor(length / 60); + let sec0 = Math.floor(length % 60) < 10 ? "0" : ""; + let sec = Math.floor(length % 60); + return `${min}:${sec0}${sec}`; } function _getName(busName) { - return busName.substring(23).split(".")[0]; + return busName.substring(23).split(".")[0]; } const MprisPlayer = GObject.registerClass( - { - Signals: { changed: {}, closed: {}, ready: {} }, - }, - class MprisPlayer extends GObject.Object { - constructor(busName) { - super(); - - this._proxy = new MprisPlayerProxy( - Gio.DBus.session, - busName, - "/org/mpris/MediaPlayer2", - this._onPlayerProxyReady.bind(this), - ); - - this._busName = busName; - this._name = _getName(busName); - this._playerIcon = - PlayerIcons?.[this._name] || PlayerIcons.deafult || ""; - this._trackArtists = []; - this._trackTitle = ""; - this._trackCoverUrl = ""; - this._coverPath = ""; - this._playBackStatus = ""; - this._canGoNext = false; - this._canGoPrev = false; - this._canPlay = false; - this._shuffle = false; - this._loopStatus = ""; - this._volume = -1; - this._length = -1; - this._position = -1; - } - - close() { - this._proxy.disconnect(this._playerBinding1); - this._proxy.disconnect(this._playerBinding2); - this._proxy = null; - - this.emit("closed"); - } - - _onPlayerProxyReady() { - this._playerBinding1 = this._proxy.connect( - "notify::g-name-owner", - () => { - if (!this._proxy.g_name_owner) this.close(); - }, - ); - this._playerBinding2 = this._proxy.connect( - "g-properties-changed", - () => { - this._updateState(); - this._cacheCoverArt(); - this.emit("changed"); - }, - ); - if (!this._proxy.g_name_owner) this.close(); - - this._updateState(); - this._cacheCoverArt(); - this.emit("ready"); - } - - _updateState() { - let metadata = {}; - for (let prop in this._proxy.Metadata) - metadata[prop] = this._proxy.Metadata[prop].deep_unpack(); - - this._trackArtists = metadata["xesam:artist"]; - if ( - !Array.isArray(this._trackArtists) || - !this._trackArtists.every( - (artist) => typeof artist === "string", - ) - ) - this._trackArtists = ["Unknown artist"]; - - this._trackTitle = metadata["xesam:title"]; - if (typeof this._trackTitle !== "string") - this._trackTitle = "Unknown title"; - - this._trackCoverUrl = metadata["mpris:artUrl"]; - if (typeof this._trackCoverUrl !== "string") - this._trackCoverUrl = ""; - - this._length = metadata["mpris:length"]; - if (typeof this._length !== "number") this._length = -1; - else - this._length = Number.parseInt( - `${this._length}`.substring(0, 3), - ); - - this._position = this._proxy.Position; - if (typeof this._position !== "number") this._position = -1; - else this._position = this._position / 1000000; - - this._playBackStatus = this._proxy.PlaybackStatus; - this._canGoNext = this._proxy.CanGoNext; - this._canGoPrev = this._proxy.CanGoPrevious; - this._canPlay = this._proxy.CanPlay; - - this._shuffle = this._proxy.Shuffle; - if (typeof this._shuffle !== "boolean") { - this._shuffle = null; - } - this._loopStatus = this._proxy.LoopStatus; - if (typeof this._loopStatus !== "string") { - this._loopStatus = null; - } - this._volume = this._proxy.Volume; - if (typeof this._volume !== "number") { - this._volume = -1; - } - } - - _cacheCoverArt() { - this._coverPath = - MEDIA_CACHE_PATH + - `${this._trackArtists.join(", ")}_${this._trackTitle}`.replace( - /[\,\*\?\"\<\>\|\#\:\?\/\']/g, - "", - ); - - if (this._trackCoverUrl === "") return; - if (this._coverPath === "_") return; - if (GLib.file_test(this._coverPath, GLib.FileTest.EXISTS)) return; - - MkDirectory(); - - // Gio.File.new_for_uri(this._trackCoverUrl).copy_async( - // Gio.File.new_for_path(this._coverPath), - // Gio.FileCopyFlags.OVERWRITE, - // GLib.PRIORITY_DEFAULT, - // null, - // null, - // (source, result) => { - // try { source.copy_finish(result) } - // catch (e) { log(`failed to cache ${this._coverPath}`, e) } - // } - // ); - - try { - Gio.File.new_for_uri(this._trackCoverUrl).copy( - Gio.File.new_for_path(this._coverPath), - Gio.FileCopyFlags.OVERWRITE, - null, - null, - ); - } catch (e) { - log(`failed to cache ${this._coverPath}`, e); - } - } - - get json() { - return { - busName: this._busName, //busName - name: _getName(this._busName), - icon: this._playerIcon, - artist: this._trackArtists.join(", "), - title: this._trackTitle, - cover: this._coverPath, - status: this._playBackStatus, - canNext: this._canGoNext, - canPrev: this._canGoPrev, - canPlay: this._canPlay, - shuffle: this._shuffle, - loop: this._loopStatus, - volume: this._volume * 100, - length: this._length, - lengthStr: _lengthStr(this._length), - position: this._position, - }; - } - }, + { + Signals: { changed: {}, closed: {}, ready: {} }, + }, + class MprisPlayer extends GObject.Object { + constructor(busName) { + super(); + + this._proxy = new MprisPlayerProxy( + Gio.DBus.session, + busName, + "/org/mpris/MediaPlayer2", + this._onPlayerProxyReady.bind(this), + ); + + this._busName = busName; + this._name = _getName(busName); + this._playerIcon = PlayerIcons?.[this._name] || PlayerIcons.deafult || ""; + this._trackArtists = []; + this._trackTitle = ""; + this._trackCoverUrl = ""; + this._coverPath = ""; + this._playBackStatus = ""; + this._canGoNext = false; + this._canGoPrev = false; + this._canPlay = false; + this._shuffle = false; + this._loopStatus = ""; + this._volume = -1; + this._length = -1; + this._position = -1; + } + + close() { + this._proxy.disconnect(this._playerBinding1); + this._proxy.disconnect(this._playerBinding2); + this._proxy = null; + + this.emit("closed"); + } + + _onPlayerProxyReady() { + this._playerBinding1 = this._proxy.connect("notify::g-name-owner", () => { + if (!this._proxy.g_name_owner) this.close(); + }); + this._playerBinding2 = this._proxy.connect("g-properties-changed", () => { + this._updateState(); + this._cacheCoverArt(); + this.emit("changed"); + }); + if (!this._proxy.g_name_owner) this.close(); + + this._updateState(); + this._cacheCoverArt(); + this.emit("ready"); + } + + _updateState() { + let metadata = {}; + for (let prop in this._proxy.Metadata) + metadata[prop] = this._proxy.Metadata[prop].deep_unpack(); + + this._trackArtists = metadata["xesam:artist"]; + if ( + !Array.isArray(this._trackArtists) || + !this._trackArtists.every((artist) => typeof artist === "string") + ) + this._trackArtists = ["Unknown artist"]; + + this._trackTitle = metadata["xesam:title"]; + if (typeof this._trackTitle !== "string") + this._trackTitle = "Unknown title"; + + this._trackCoverUrl = metadata["mpris:artUrl"]; + if (typeof this._trackCoverUrl !== "string") this._trackCoverUrl = ""; + + this._length = metadata["mpris:length"]; + if (typeof this._length !== "number") this._length = -1; + else this._length = Number.parseInt(`${this._length}`.substring(0, 3)); + + this._position = this._proxy.Position; + if (typeof this._position !== "number") this._position = -1; + else this._position = this._position / 1000000; + + this._playBackStatus = this._proxy.PlaybackStatus; + this._canGoNext = this._proxy.CanGoNext; + this._canGoPrev = this._proxy.CanGoPrevious; + this._canPlay = this._proxy.CanPlay; + + this._shuffle = this._proxy.Shuffle; + if (typeof this._shuffle !== "boolean") { + this._shuffle = null; + } + this._loopStatus = this._proxy.LoopStatus; + if (typeof this._loopStatus !== "string") { + this._loopStatus = null; + } + this._volume = this._proxy.Volume; + if (typeof this._volume !== "number") { + this._volume = -1; + } + } + + _cacheCoverArt() { + this._coverPath = + MEDIA_CACHE_PATH + + `${this._trackArtists.join(", ")}_${this._trackTitle}`.replace( + /[\,\*\?\"\<\>\|\#\:\?\/\']/g, + "", + ); + + if (this._trackCoverUrl === "") return; + if (this._coverPath === "_") return; + if (GLib.file_test(this._coverPath, GLib.FileTest.EXISTS)) return; + + MkDirectory(); + + // Gio.File.new_for_uri(this._trackCoverUrl).copy_async( + // Gio.File.new_for_path(this._coverPath), + // Gio.FileCopyFlags.OVERWRITE, + // GLib.PRIORITY_DEFAULT, + // null, + // null, + // (source, result) => { + // try { source.copy_finish(result) } + // catch (e) { log(`failed to cache ${this._coverPath}`, e) } + // } + // ); + + try { + Gio.File.new_for_uri(this._trackCoverUrl).copy( + Gio.File.new_for_path(this._coverPath), + Gio.FileCopyFlags.OVERWRITE, + null, + null, + ); + } catch (e) { + log(`failed to cache ${this._coverPath}`, e); + } + } + + get json() { + return { + busName: this._busName, //busName + name: _getName(this._busName), + icon: this._playerIcon, + artist: this._trackArtists.join(", "), + title: this._trackTitle, + cover: this._coverPath, + status: this._playBackStatus, + canNext: this._canGoNext, + canPrev: this._canGoPrev, + canPlay: this._canPlay, + shuffle: this._shuffle, + loop: this._loopStatus, + volume: this._volume * 100, + length: this._length, + lengthStr: _lengthStr(this._length), + position: this._position, + }; + } + }, ); export const Media = GObject.registerClass( - { - Signals: { sync: {}, positions: {} }, - }, - class Media extends GObject.Object { - _init() { - super._init(); - - this._json = {}; - this._positions = {}; - this._players = new Map(); - this._proxy = new DBusProxy( - Gio.DBus.session, - "org.freedesktop.DBus", - "/org/freedesktop/DBus", - this._onProxyReady.bind(this), - ); - } - - get json() { - return this._json; - } - get positions() { - return this._positions; - } - - _addPlayer(busName) { - if (this._players.get(busName)) return; - - let player = new MprisPlayer(busName); - player.connect("closed", () => { - this._players.delete(busName); - this._sync(); - }); - player.connect("changed", this._sync.bind(this)); - player.connect("ready", this._sync.bind(this)); - this._players.set(busName, player); - } - - _onProxyReady() { - this._proxy.ListNamesRemote(([names]) => { - names.forEach((name) => { - if (name.startsWith("org.mpris.MediaPlayer2.")) - this._addPlayer(name); - }); - }); - this._proxy.connectSignal( - "NameOwnerChanged", - this._onNameOwnerChanged.bind(this), - ); - this._sync(); - } - - _onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) { - if (!name.startsWith("org.mpris.MediaPlayer2.")) return; - - if (newOwner && !oldOwner) this._addPlayer(name); - } - - _sync() { - let preferred = null; - let players = []; - for (const [_, player] of this._players) { - if (player.json.busName.includes(PREFERRED_PLAYER)) - preferred = player.json; - - players.push(player.json); - } - - if (this._players.size === 1) preferred = players[0]; - - this._json = { - preferred, - players, - }; - this.emit("sync"); - } - - getPositions() { - if (this._players.size === 0) return; - let playersReady = 0; - let positions = {}; - for (const [busName, _] of this._players) { - new MprisPlayer(busName).connect("ready", (mpris) => { - positions[mpris.json.name] = { - length: mpris.json.length, - lengthStr: _lengthStr(mpris.json.length), - position: mpris.json.position, - positionStr: _lengthStr(mpris.json.position), - }; - playersReady++; - - if (playersReady === this._players.size) { - this._positions = positions; - this.emit("positions"); - } - - mpris.close(); - }); - } - return true; - } - }, + { + Signals: { sync: {}, positions: {} }, + }, + class Media extends GObject.Object { + _init() { + super._init(); + + this._json = {}; + this._positions = {}; + this._players = new Map(); + this._proxy = new DBusProxy( + Gio.DBus.session, + "org.freedesktop.DBus", + "/org/freedesktop/DBus", + this._onProxyReady.bind(this), + ); + } + + get json() { + return this._json; + } + get positions() { + return this._positions; + } + + _addPlayer(busName) { + if (this._players.get(busName)) return; + + let player = new MprisPlayer(busName); + player.connect("closed", () => { + this._players.delete(busName); + this._sync(); + }); + player.connect("changed", this._sync.bind(this)); + player.connect("ready", this._sync.bind(this)); + this._players.set(busName, player); + } + + _onProxyReady() { + this._proxy.ListNamesRemote(([names]) => { + names.forEach((name) => { + if (name.startsWith("org.mpris.MediaPlayer2.")) this._addPlayer(name); + }); + }); + this._proxy.connectSignal( + "NameOwnerChanged", + this._onNameOwnerChanged.bind(this), + ); + this._sync(); + } + + _onNameOwnerChanged(proxy, sender, [name, oldOwner, newOwner]) { + if (!name.startsWith("org.mpris.MediaPlayer2.")) return; + + if (newOwner && !oldOwner) this._addPlayer(name); + } + + _sync() { + let preferred = null; + let players = []; + for (const [_, player] of this._players) { + if (player.json.busName.includes(PREFERRED_PLAYER)) + preferred = player.json; + + players.push(player.json); + } + + if (this._players.size === 1) preferred = players[0]; + + this._json = { + preferred, + players, + }; + this.emit("sync"); + } + + getPositions() { + if (this._players.size === 0) return; + let playersReady = 0; + let positions = {}; + for (const [busName, _] of this._players) { + new MprisPlayer(busName).connect("ready", (mpris) => { + positions[mpris.json.name] = { + length: mpris.json.length, + lengthStr: _lengthStr(mpris.json.length), + position: mpris.json.position, + positionStr: _lengthStr(mpris.json.position), + }; + playersReady++; + + if (playersReady === this._players.size) { + this._positions = positions; + this.emit("positions"); + } + + mpris.close(); + }); + } + return true; + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/network.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/network.js index 7d150c30..5f9bba8b 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/network.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/network.js @@ -1,154 +1,144 @@ import { NM, Gio, GObject } from "./lib.js"; function showNotification(title, message) { - let notification = new Gio.Notification(); - notification.set_title(title); - notification.set_body(message); - notification.set_priority(Gio.NotificationPriority.NORMAL); - application.register(null); - application.send_notification(null, notification); - GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 2, () => { - application.quit(); - return GLib.SOURCE_REMOVE; - }); + let notification = new Gio.Notification(); + notification.set_title(title); + notification.set_body(message); + notification.set_priority(Gio.NotificationPriority.NORMAL); + application.register(null); + application.send_notification(null, notification); + GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 2, () => { + application.quit(); + return GLib.SOURCE_REMOVE; + }); } Gio._promisify(NM.Client, "new_async"); Gio._promisify(NM.DeviceWifi.prototype, "request_scan_async"); const WifiStyles = { - "󰪎": "none", - "󰤮": "low", - "󰤯": "low", - "󰤟": "low", - "󰤢": "medium", - "󰤥": "medium", - "󰤨": "high", + "󰪎": "none", + "󰤮": "low", + "󰤯": "low", + "󰤟": "low", + "󰤢": "medium", + "󰤥": "medium", + "󰤨": "high", }; export const Network = GObject.registerClass( - { - Signals: { sync: {} }, - }, - class Network extends GObject.Object { - constructor() { - super(); - - this._json = {}; - this._getClient(); - } - - get json() { - return this._json; - } - - _getDevice(devType) { - return this._client - .get_devices() - .find((device) => device.get_device_type() === devType); - } - - async _getClient() { - this._client = await NM.Client.new_async(null); - this._client.connect( - "notify::wireless-enabled", - this._sync.bind(this), - ); - this._client.connect("notify::connectivity", this._sync.bind(this)); - this._client.connect( - "notify::primary-connection", - this._sync.bind(this), - ); - this._client.connect( - "notify::activating-connection", - this._sync.bind(this), - ); - - this._wifi = this._getDevice(NM.DeviceType.WIFI); - if (this._wifi) { - this._wifi.connect( - "notify::active-access-point", - this._activeAp.bind(this), - ); - //this._wifi.connect('access-point-added', (_, ap) => this._apAdded(ap)); - //this._wifi.connect('access-point-removed', (_, ap) => this._apRemoved(ap)); - } - - this._activeAp(); - this._sync(); - } - - //_apAdded(ap) { - // let ssid = NM.utils_ssid_to_utf8(ap.get_ssid().get_data()); - // showNotification('Access Point Added', `The access point "${ssid}" has been added.`); - // this._sync(); - //} - - //_apRemoved(ap) { - // let ssid = NM.utils_ssid_to_utf8(ap.get_ssid().get_data()); - // showNotification('Access Point Removed', `The access point "${ssid}" has been removed.`); - // this._sync(); - //} - - _activeAp() { - if (this._ap) this._ap.disconnect(this._apBind); - this._ap = this._wifi?.get_active_access_point(); - if (!this._ap) return; - this._apBind = this._ap.connect( - "notify::strength", - this._sync.bind(this), - ); - this._sync(); - } - - _sync() { - const mainConnection = - this._client.get_primary_connection() || - this._client.get_activating_connection(); - - const primary_type = mainConnection?.type || null; // 802-11-wireless ; 802-3-ethernet - const internet = - this._client.connectivity === NM.ConnectivityState.FULL; - - let wifi = { - primary: primary_type === "802-11-wireless", - enabled: this._client.wireless_enabled, - state: this._client.wireless_enabled ? "on" : "off", - ssid: - (this._ap && - NM.utils_ssid_to_utf8( - this._ap.get_ssid().get_data(), - )) || - "Unknown", - strength: - this._client.wireless_enabled && mainConnection - ? `${this._ap?.strength}%` - : "󰂭", - icon: ["󰤮", "󰤯", "󰤟", "󰤢", "󰤥", "󰤨"][ - Math.ceil(this._ap?.strength / 20) - ], - }; - if (!internet) { - wifi.strength = "󰪎"; - wifi.icon = "󰪎"; - } - wifi.style = WifiStyles[wifi.icon]; - - let wired = { - primary: primary_type === "802-3-ethernet", - icon: internet ? "󰛳" : "󰪎", - }; - - this._json = { - primary: - { "802-3-ethernet": "wired", "802-11-wireless": "wifi" }[ - primary_type - ] || "none", - none: { icon: "󰤮" }, - wifi, - wired, - }; - this.emit("sync"); - } - }, + { + Signals: { sync: {} }, + }, + class Network extends GObject.Object { + constructor() { + super(); + + this._json = {}; + this._getClient(); + } + + get json() { + return this._json; + } + + _getDevice(devType) { + return this._client + .get_devices() + .find((device) => device.get_device_type() === devType); + } + + async _getClient() { + this._client = await NM.Client.new_async(null); + this._client.connect("notify::wireless-enabled", this._sync.bind(this)); + this._client.connect("notify::connectivity", this._sync.bind(this)); + this._client.connect("notify::primary-connection", this._sync.bind(this)); + this._client.connect( + "notify::activating-connection", + this._sync.bind(this), + ); + + this._wifi = this._getDevice(NM.DeviceType.WIFI); + if (this._wifi) { + this._wifi.connect( + "notify::active-access-point", + this._activeAp.bind(this), + ); + //this._wifi.connect('access-point-added', (_, ap) => this._apAdded(ap)); + //this._wifi.connect('access-point-removed', (_, ap) => this._apRemoved(ap)); + } + + this._activeAp(); + this._sync(); + } + + //_apAdded(ap) { + // let ssid = NM.utils_ssid_to_utf8(ap.get_ssid().get_data()); + // showNotification('Access Point Added', `The access point "${ssid}" has been added.`); + // this._sync(); + //} + + //_apRemoved(ap) { + // let ssid = NM.utils_ssid_to_utf8(ap.get_ssid().get_data()); + // showNotification('Access Point Removed', `The access point "${ssid}" has been removed.`); + // this._sync(); + //} + + _activeAp() { + if (this._ap) this._ap.disconnect(this._apBind); + this._ap = this._wifi?.get_active_access_point(); + if (!this._ap) return; + this._apBind = this._ap.connect( + "notify::strength", + this._sync.bind(this), + ); + this._sync(); + } + + _sync() { + const mainConnection = + this._client.get_primary_connection() || + this._client.get_activating_connection(); + + const primary_type = mainConnection?.type || null; // 802-11-wireless ; 802-3-ethernet + const internet = this._client.connectivity === NM.ConnectivityState.FULL; + + let wifi = { + primary: primary_type === "802-11-wireless", + enabled: this._client.wireless_enabled, + state: this._client.wireless_enabled ? "on" : "off", + ssid: + (this._ap && NM.utils_ssid_to_utf8(this._ap.get_ssid().get_data())) || + "Unknown", + strength: + this._client.wireless_enabled && mainConnection + ? `${this._ap?.strength}%` + : "󰂭", + icon: ["󰤮", "󰤯", "󰤟", "󰤢", "󰤥", "󰤨"][ + Math.ceil(this._ap?.strength / 20) + ], + }; + if (!internet) { + wifi.strength = "󰪎"; + wifi.icon = "󰪎"; + } + wifi.style = WifiStyles[wifi.icon]; + + let wired = { + primary: primary_type === "802-3-ethernet", + icon: internet ? "󰛳" : "󰪎", + }; + + this._json = { + primary: + { "802-3-ethernet": "wired", "802-11-wireless": "wifi" }[ + primary_type + ] || "none", + none: { icon: "󰤮" }, + wifi, + wired, + }; + this.emit("sync"); + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/notifications.js b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/notifications.js index b4de8c87..3185da7b 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/notifications.js +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/host/notifications.js @@ -1,286 +1,276 @@ import { NotificationIFace } from "./dbus.js"; import { - NOTIFICATIONS_CACHE_PATH, - NOTIFICATIONS_BANNER_TIME_OUT, - MkDirectory, - CACHE_PATH, + NOTIFICATIONS_CACHE_PATH, + NOTIFICATIONS_BANNER_TIME_OUT, + MkDirectory, + CACHE_PATH, } from "./main.js"; import { GObject, Gio, Gtk, GdkPixbuf, GLib } from "./lib.js"; export const Notifications = GObject.registerClass( - { - Signals: { sync: {} }, - }, - class Notifications extends GObject.Object { - constructor(fg_color = "white") { - super(); - - this._fgColor = fg_color; - this._json = {}; - this._dnd = false; - this._idCound = 1; - this._notifications = new Map(); - this._popups = new Map(); - this._readFromFile(); - this._register(); + { + Signals: { sync: {} }, + }, + class Notifications extends GObject.Object { + constructor(fg_color = "white") { + super(); + + this._fgColor = fg_color; + this._json = {}; + this._dnd = false; + this._idCound = 1; + this._notifications = new Map(); + this._popups = new Map(); + this._readFromFile(); + this._register(); + this._sync(); + } + + get json() { + return this._json; + } + + get DoNotDisturb() { + return this._dnd; + } + + Clear() { + for (const [_, notification] of this._notifications) { + this.CloseNotification(notification.id); + } + } + + Notify( + app_name, + replaces_id, + app_icon, + summary, + body, + actions, + hints, + time_out, + ) { + let acts = []; + for (let i = 0; i < actions.length; i += 2) { + if (actions[i + 1] !== "") + acts.push({ + label: actions[i + 1], + id: actions[i], + }); + } + let id = replaces_id || this._idCound++; + let date = new Date(); + let notification = { + id, + app_name, + app_icon, + summary, + body, + actions: acts, + time: { + hour: date.getHours(), + minute: + date.getMinutes() > 9 ? date.getMinutes() : `0${date.getMinutes()}`, + }, + image: + this._parseImage(hints["image-data"], `${summary}${id}`) || + this._parseIcon(app_icon, `${summary}${id}`) || + this._parseIcon(app_name, `${summary}${id}`), + }; + this._notifications.set(notification.id, notification); + if (!this._dnd) { + this._popups.set(notification.id, notification); + GLib.timeout_add( + GLib.PRIORITY_DEFAULT, + time_out > 0 ? time_out : NOTIFICATIONS_BANNER_TIME_OUT, + () => { + if (!this._popups.has(id)) return; + this._popups.delete(notification.id); this._sync(); - } - - get json() { - return this._json; - } - - get DoNotDisturb() { - return this._dnd; - } - - Clear() { - for (const [_, notification] of this._notifications) { - this.CloseNotification(notification.id); - } - } - - Notify( - app_name, - replaces_id, - app_icon, - summary, - body, - actions, - hints, - time_out, - ) { - let acts = []; - for (let i = 0; i < actions.length; i += 2) { - if (actions[i + 1] !== "") - acts.push({ - label: actions[i + 1], - id: actions[i], - }); - } - let id = replaces_id || this._idCound++; - let date = new Date(); - let notification = { - id, - app_name, - app_icon, - summary, - body, - actions: acts, - time: { - hour: date.getHours(), - minute: - date.getMinutes() > 9 - ? date.getMinutes() - : `0${date.getMinutes()}`, - }, - image: - this._parseImage(hints["image-data"], `${summary}${id}`) || - this._parseIcon(app_icon, `${summary}${id}`) || - this._parseIcon(app_name, `${summary}${id}`), - }; - this._notifications.set(notification.id, notification); - if (!this._dnd) { - this._popups.set(notification.id, notification); - GLib.timeout_add( - GLib.PRIORITY_DEFAULT, - time_out > 0 ? time_out : NOTIFICATIONS_BANNER_TIME_OUT, - () => { - if (!this._popups.has(id)) return; - this._popups.delete(notification.id); - this._sync(); - }, - ); - } - this._sync(); - return notification.id; - } - - ToggleDND() { - this._dnd = !this._dnd; - this._sync(); - } - - DismissNotification(id) { - this._popups.delete(id); - this._sync(); - } - - DismissLatestNotification() { - this._popups.delete([...this._popups.keys()].pop()); - this._sync(); - } - - CloseNotification(id) { - if (!this._notifications.has(id)) return; - this._dbus.emit_signal( - "NotificationClosed", - GLib.Variant.new("(uu)", [id, 2]), - ); - this._notifications.delete(id); - this._popups.delete(id); - this._sync(); - } - - CloseLatestNotification() { - const latestNotificationId = [...this._notifications.keys()].pop(); - if (latestNotificationId) { - this.CloseNotification(latestNotificationId); - } - } - - InvokeAction(id, action) { - if (!this._notifications.has(id)) return; - this._dbus.emit_signal( - "ActionInvoked", - GLib.Variant.new("(us)", [id, action]), - ); - this._notifications.delete(id); - this._popups.delete(id); - this._sync(); - } - - GetCapabilities() { - return ["actions", "body", "icon-static", "persistence"]; - } - - GetServerInformation() { - return new GLib.Variant("(ssss)", ["host", "isabel", "0.1", "1.2"]); - } - - _register() { - Gio.bus_own_name( - Gio.BusType.SESSION, - "org.freedesktop.Notifications", - Gio.BusNameOwnerFlags.NONE, - (connection, _) => { - this._dbus = Gio.DBusExportedObject.wrapJSObject( - NotificationIFace, - this, - ); - this._dbus.export( - connection, - "/org/freedesktop/Notifications", - ); - }, - null, - () => { - print("Another Notification Daemon is already running!"); - }, - ); - } - - _filterName(name) { - return ( - NOTIFICATIONS_CACHE_PATH + - name.replace(/[\ \,\*\?\"\<\>\|\#\:\?\/\!\']/g, "") + - ".png" - ); - } - - _parseIcon(icon_name, name) { - if (!icon_name) return; - - MkDirectory(); - let fileName = this._filterName(name); - let iconInfo = Gtk.IconTheme.get_default().lookup_by_gicon( - Gio.Icon.new_for_string(icon_name), - 128, - null, - ); - - if (!iconInfo) return null; - - let output_stream = Gio.File.new_for_path(fileName).replace( - null, - false, - Gio.FileCreateFlags.NONE, - null, - ); - - iconInfo - .load_icon() - .save_to_streamv(output_stream, "png", null, null, null); - - output_stream.close(null); - - if (icon_name.includes("-symbolic")) - GLib.spawn_command_line_sync(`convert ${fileName} -alpha on + }, + ); + } + this._sync(); + return notification.id; + } + + ToggleDND() { + this._dnd = !this._dnd; + this._sync(); + } + + DismissNotification(id) { + this._popups.delete(id); + this._sync(); + } + + DismissLatestNotification() { + this._popups.delete([...this._popups.keys()].pop()); + this._sync(); + } + + CloseNotification(id) { + if (!this._notifications.has(id)) return; + this._dbus.emit_signal( + "NotificationClosed", + GLib.Variant.new("(uu)", [id, 2]), + ); + this._notifications.delete(id); + this._popups.delete(id); + this._sync(); + } + + CloseLatestNotification() { + const latestNotificationId = [...this._notifications.keys()].pop(); + if (latestNotificationId) { + this.CloseNotification(latestNotificationId); + } + } + + InvokeAction(id, action) { + if (!this._notifications.has(id)) return; + this._dbus.emit_signal( + "ActionInvoked", + GLib.Variant.new("(us)", [id, action]), + ); + this._notifications.delete(id); + this._popups.delete(id); + this._sync(); + } + + GetCapabilities() { + return ["actions", "body", "icon-static", "persistence"]; + } + + GetServerInformation() { + return new GLib.Variant("(ssss)", ["host", "isabel", "0.1", "1.2"]); + } + + _register() { + Gio.bus_own_name( + Gio.BusType.SESSION, + "org.freedesktop.Notifications", + Gio.BusNameOwnerFlags.NONE, + (connection, _) => { + this._dbus = Gio.DBusExportedObject.wrapJSObject( + NotificationIFace, + this, + ); + this._dbus.export(connection, "/org/freedesktop/Notifications"); + }, + null, + () => { + print("Another Notification Daemon is already running!"); + }, + ); + } + + _filterName(name) { + return ( + NOTIFICATIONS_CACHE_PATH + + name.replace(/[\ \,\*\?\"\<\>\|\#\:\?\/\!\']/g, "") + + ".png" + ); + } + + _parseIcon(icon_name, name) { + if (!icon_name) return; + + MkDirectory(); + let fileName = this._filterName(name); + let iconInfo = Gtk.IconTheme.get_default().lookup_by_gicon( + Gio.Icon.new_for_string(icon_name), + 128, + null, + ); + + if (!iconInfo) return null; + + let output_stream = Gio.File.new_for_path(fileName).replace( + null, + false, + Gio.FileCreateFlags.NONE, + null, + ); + + iconInfo + .load_icon() + .save_to_streamv(output_stream, "png", null, null, null); + + output_stream.close(null); + + if (icon_name.includes("-symbolic")) + GLib.spawn_command_line_sync(`convert ${fileName} -alpha on -fill ${this._fgColor} -colorize 100% -bordercolor transparent -border 16 ${fileName}`); - return fileName; - } - - _readFromFile() { - try { - const file = Gio.File.new_for_path( - CACHE_PATH + "notifications.json", - ); - const [, contents, etag] = file.load_contents(null); - const json = JSON.parse( - new TextDecoder("utf-8").decode(contents), - ); - json.notifications.forEach((n) => { - if (n.id > this._idCound) this._idCound = n.id + 1; - this._notifications.set(n.id, n); - }); - } catch (error) { - print("There were no cached notifications found!"); - print( - "If you want your notifications to be cached run with --file flag", - ); - } - } - - _parseImage(image_data, name) { - if (!image_data) return; - MkDirectory(); - let fileName = this._filterName(name); - let image = image_data.recursiveUnpack(); - let pixbuf = GdkPixbuf.Pixbuf.new_from_bytes( - image[6], - GdkPixbuf.Colorspace.RGB, - image[3], - image[4], - image[0], - image[1], - image[2], - ); - - let output_stream = Gio.File.new_for_path(fileName).replace( - null, - false, - Gio.FileCreateFlags.NONE, - null, - ); - - pixbuf.save_to_streamv(output_stream, "png", null, null, null); - output_stream.close(null); - - return fileName; - } - - _sync() { - let notifications = [], - popups = []; - for (const [_, notification] of this._notifications) - notifications.push(notification); - - for (const [_, notification] of this._popups) - popups.push(notification); - - this._json = { - dnd: { - enabled: this._dnd, - state: this._dnd ? "on" : "off", - icon: this._dnd ? "󰂛" : "󰂚", - }, - count: notifications.length, - icon: this._dnd ? "󰂛" : notifications.length > 0 ? "󱅫" : "󰂚", - notifications, - popups, - }; - this.emit("sync"); - } - }, + return fileName; + } + + _readFromFile() { + try { + const file = Gio.File.new_for_path(CACHE_PATH + "notifications.json"); + const [, contents, etag] = file.load_contents(null); + const json = JSON.parse(new TextDecoder("utf-8").decode(contents)); + json.notifications.forEach((n) => { + if (n.id > this._idCound) this._idCound = n.id + 1; + this._notifications.set(n.id, n); + }); + } catch (error) { + print("There were no cached notifications found!"); + print( + "If you want your notifications to be cached run with --file flag", + ); + } + } + + _parseImage(image_data, name) { + if (!image_data) return; + MkDirectory(); + let fileName = this._filterName(name); + let image = image_data.recursiveUnpack(); + let pixbuf = GdkPixbuf.Pixbuf.new_from_bytes( + image[6], + GdkPixbuf.Colorspace.RGB, + image[3], + image[4], + image[0], + image[1], + image[2], + ); + + let output_stream = Gio.File.new_for_path(fileName).replace( + null, + false, + Gio.FileCreateFlags.NONE, + null, + ); + + pixbuf.save_to_streamv(output_stream, "png", null, null, null); + output_stream.close(null); + + return fileName; + } + + _sync() { + let notifications = [], + popups = []; + for (const [_, notification] of this._notifications) + notifications.push(notification); + + for (const [_, notification] of this._popups) popups.push(notification); + + this._json = { + dnd: { + enabled: this._dnd, + state: this._dnd ? "on" : "off", + icon: this._dnd ? "󰂛" : "󰂚", + }, + count: notifications.length, + icon: this._dnd ? "󰂛" : notifications.length > 0 ? "󱅫" : "󰂚", + notifications, + popups, + }; + this.emit("sync"); + } + }, ); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scripts/todo b/home/isabel/programs/configs/gui/bars/eww/config/scripts/todo index 26ee7712..8a7d5af6 100755 --- a/home/isabel/programs/configs/gui/bars/eww/config/scripts/todo +++ b/home/isabel/programs/configs/gui/bars/eww/config/scripts/todo @@ -3,432 +3,425 @@ const { Gio, GLib } = imports.gi; const SUBSTITUTES_PATH = - GLib.get_home_dir() + "/.local/share/todo/substitutes.json"; + GLib.get_home_dir() + "/.local/share/todo/substitutes.json"; const TASKS_PATH = GLib.get_home_dir() + "/Documents/tasks.json"; const TERMINAL_WIDTH = 50; function getSubstitutes() { - try { - let file = Gio.File.new_for_path(SUBSTITUTES_PATH); - let [, contents] = file.load_contents(null); - return JSON.parse(new TextDecoder().decode(contents)); - } catch { - return { days: [], months: [] }; - } + try { + let file = Gio.File.new_for_path(SUBSTITUTES_PATH); + let [, contents] = file.load_contents(null); + return JSON.parse(new TextDecoder().decode(contents)); + } catch { + return { days: [], months: [] }; + } } function getTasks() { - try { - let file = Gio.File.new_for_path(TASKS_PATH); - let [, contents] = file.load_contents(null); - let list = JSON.parse(new TextDecoder().decode(contents)); - let tasks = []; - list.forEach((t) => tasks.push(new Task(t))); - return tasks; - } catch { - return []; - } + try { + let file = Gio.File.new_for_path(TASKS_PATH); + let [, contents] = file.load_contents(null); + let list = JSON.parse(new TextDecoder().decode(contents)); + let tasks = []; + list.forEach((t) => tasks.push(new Task(t))); + return tasks; + } catch { + return []; + } } function writeFile(tasks) { - let file = Gio.File.new_for_path(TASKS_PATH); - if (!GLib.file_test(TASKS_PATH, GLib.FileTest.EXISTS)) - file.create(Gio.FileCreateFlags.NONE, null); - - file.replace_contents( - JSON.stringify(tasks, null, 4), - null, - false, - Gio.FileCreateFlags.REPLACE_DESTINATION, - null, - ); + let file = Gio.File.new_for_path(TASKS_PATH); + if (!GLib.file_test(TASKS_PATH, GLib.FileTest.EXISTS)) + file.create(Gio.FileCreateFlags.NONE, null); + + file.replace_contents( + JSON.stringify(tasks, null, 4), + null, + false, + Gio.FileCreateFlags.REPLACE_DESTINATION, + null, + ); } class Date { - constructor(p) { - this.year = p?.year; - this.month = p?.month; - this.day = p?.day; - this.hour = p?.hour; - this.minutes = p?.minutes; - this.asap = p?.asap || false; - - if (typeof p === "string") this.fromString(p); - } - - isEmpty() { - return ( - !this.year && - !this.month && - !this.day && - !this.hour && - !this.minutes - ); - } - - isLate() { - let d = GLib.DateTime.new_now_local(); - if ( - this.compare( - new Date({ - year: d.get_year(), - month: d.get_month(), - day: d.get_day_of_month(), - hour: d.get_hour(), - minutes: d.get_minute(), - }), - ) < 0 - ) { - return true; - } - return false; - } - - isToday() { - let now = GLib.DateTime.new_now_local(); - return ( - this.month === now.get_month() && - this.day === now.get_day_of_month() - ); - } - - toString() { - if (this.asap) return " asap! "; - - let m, d, h, min, md, hm; - if (this.month) - m = `${this.month < 10 ? `0${this.month}` : this.month}`; - else m = "--"; - - if (this.day) d = `${this.day < 10 ? `0${this.day}` : this.day}`; - else d = "--"; - - if (this.hour) h = `${this.hour < 10 ? `0${this.hour}` : this.hour}`; - else h = "--"; - - if (this.minutes) - min = `${this.minutes < 10 ? `0${this.minutes}` : this.minutes}`; - else min = "00"; - - md = `${m}/${d}`; - hm = `${h}:${min}`; - if (!this.month && !this.day) md = " "; - if (!this.hour && !this.minutes) hm = " "; - if (md === " " && (this.hour || this.minutes)) md = "today"; - if (this.isToday()) md = "today"; - - return `${md} ${hm}`; - } - - valid() { - let now = GLib.DateTime.new_now_local(); - let year = this?.year || now.get_year(); - let month = this?.month || now.get_month(); - let day = this?.day || now.get_day_of_month(); - let hour = this?.hour || now.get_hour(); - let minutes = this?.minutes || now.get_minute(); - return GLib.DateTime.new_local(year, month, day, hour, minutes, 0); - } - - compare(d2) { - if (this.asap) return -1; - if (d2.asap) return 1; - if (this.isEmpty() && d2.isEmpty()) return 0; - if (this.isEmpty()) return 1; - if (d2.isEmpty()) return -1; - - if (this.year > d2.year) return 1; - else if (this.year < d2.year) return -1; - else if (this.month > d2.month) return 1; - else if (this.month < d2.month) return -1; - else if (this.day > d2.day) return 1; - else if (this.day < d2.day) return -1; - else if (this.hour > d2.hour) return 1; - else if (this.hour < d2.hour) return -1; - else if (this.minutes > d2.minutes) return 1; - else if (this.minutes < d2.minutes) return -1; - - return 0; - } - - fromString(str) { - let substitutes = getSubstitutes(); - let days = substitutes.days; - let months = substitutes.months; - - str.split(" ").forEach((e) => { - if (e.toLowerCase() === "asap") this.asap = true; - if (days[e]) this.day = days[e]; - if (months[e]) this.month = months[e]; - let md = e.split("/"); - if (md.length === 2) { - this.month = Number(md[0]); - this.day = Number(md[1]); - } - let hm = e.split(":"); - if (hm.length === 2) { - this.hour = Number(hm[0]); - this.minutes = Number(hm[1]); - } - let ymd = e.split("/"); - if (ymd.length === 3) { - this.year = Number(md[0]); - this.month = Number(md[1]); - this.day = Number(md[2]); - } - if (e.toLowerCase() === "today") { - let now = GLib.DateTime.new_now_local(); - this.month = now.get_month(); - this.day = now.get_day_of_month(); - } - }); - - if (this.year == NaN) this.year = undefined; - if (this.month == NaN) this.month = undefined; - if (this.day == NaN) this.day = undefined; - if (this.hour == NaN) this.hour = undefined; - if (this.minutes == NaN) this.minutes = undefined; - - if (!this.valid()) { - throw new Error("Wrong date"); - } - - return this; - } + constructor(p) { + this.year = p?.year; + this.month = p?.month; + this.day = p?.day; + this.hour = p?.hour; + this.minutes = p?.minutes; + this.asap = p?.asap || false; + + if (typeof p === "string") this.fromString(p); + } + + isEmpty() { + return ( + !this.year && !this.month && !this.day && !this.hour && !this.minutes + ); + } + + isLate() { + let d = GLib.DateTime.new_now_local(); + if ( + this.compare( + new Date({ + year: d.get_year(), + month: d.get_month(), + day: d.get_day_of_month(), + hour: d.get_hour(), + minutes: d.get_minute(), + }), + ) < 0 + ) { + return true; + } + return false; + } + + isToday() { + let now = GLib.DateTime.new_now_local(); + return ( + this.month === now.get_month() && this.day === now.get_day_of_month() + ); + } + + toString() { + if (this.asap) return " asap! "; + + let m, d, h, min, md, hm; + if (this.month) m = `${this.month < 10 ? `0${this.month}` : this.month}`; + else m = "--"; + + if (this.day) d = `${this.day < 10 ? `0${this.day}` : this.day}`; + else d = "--"; + + if (this.hour) h = `${this.hour < 10 ? `0${this.hour}` : this.hour}`; + else h = "--"; + + if (this.minutes) + min = `${this.minutes < 10 ? `0${this.minutes}` : this.minutes}`; + else min = "00"; + + md = `${m}/${d}`; + hm = `${h}:${min}`; + if (!this.month && !this.day) md = " "; + if (!this.hour && !this.minutes) hm = " "; + if (md === " " && (this.hour || this.minutes)) md = "today"; + if (this.isToday()) md = "today"; + + return `${md} ${hm}`; + } + + valid() { + let now = GLib.DateTime.new_now_local(); + let year = this?.year || now.get_year(); + let month = this?.month || now.get_month(); + let day = this?.day || now.get_day_of_month(); + let hour = this?.hour || now.get_hour(); + let minutes = this?.minutes || now.get_minute(); + return GLib.DateTime.new_local(year, month, day, hour, minutes, 0); + } + + compare(d2) { + if (this.asap) return -1; + if (d2.asap) return 1; + if (this.isEmpty() && d2.isEmpty()) return 0; + if (this.isEmpty()) return 1; + if (d2.isEmpty()) return -1; + + if (this.year > d2.year) return 1; + else if (this.year < d2.year) return -1; + else if (this.month > d2.month) return 1; + else if (this.month < d2.month) return -1; + else if (this.day > d2.day) return 1; + else if (this.day < d2.day) return -1; + else if (this.hour > d2.hour) return 1; + else if (this.hour < d2.hour) return -1; + else if (this.minutes > d2.minutes) return 1; + else if (this.minutes < d2.minutes) return -1; + + return 0; + } + + fromString(str) { + let substitutes = getSubstitutes(); + let days = substitutes.days; + let months = substitutes.months; + + str.split(" ").forEach((e) => { + if (e.toLowerCase() === "asap") this.asap = true; + if (days[e]) this.day = days[e]; + if (months[e]) this.month = months[e]; + let md = e.split("/"); + if (md.length === 2) { + this.month = Number(md[0]); + this.day = Number(md[1]); + } + let hm = e.split(":"); + if (hm.length === 2) { + this.hour = Number(hm[0]); + this.minutes = Number(hm[1]); + } + let ymd = e.split("/"); + if (ymd.length === 3) { + this.year = Number(md[0]); + this.month = Number(md[1]); + this.day = Number(md[2]); + } + if (e.toLowerCase() === "today") { + let now = GLib.DateTime.new_now_local(); + this.month = now.get_month(); + this.day = now.get_day_of_month(); + } + }); + + if (this.year == NaN) this.year = undefined; + if (this.month == NaN) this.month = undefined; + if (this.day == NaN) this.day = undefined; + if (this.hour == NaN) this.hour = undefined; + if (this.minutes == NaN) this.minutes = undefined; + + if (!this.valid()) { + throw new Error("Wrong date"); + } + + return this; + } } class Task { - constructor(p) { - (this.title = p?.title), - (this.desc = p?.desc), - (this.date = new Date(p?.date)); - } - - parseDate(date) { - this.date.fromString(date); - } + constructor(p) { + (this.title = p?.title), + (this.desc = p?.desc), + (this.date = new Date(p?.date)); + } + + parseDate(date) { + this.date.fromString(date); + } } function add(input = {}) { - if (!input.title) throw new Error("Needs a title"); - let tasks = getTasks(); - tasks.push(new Task(input)); - tasks.sort((a, b) => a.date.compare(b.date)); - writeFile(tasks); + if (!input.title) throw new Error("Needs a title"); + let tasks = getTasks(); + tasks.push(new Task(input)); + tasks.sort((a, b) => a.date.compare(b.date)); + writeFile(tasks); } function remove(input = {}) { - let tasks = getTasks(); - input.remove.split(" ").forEach((i) => { - if (!tasks[i - 1]) throw new Error("Index not found."); - tasks[i - 1] = null; - }); - writeFile(tasks.filter((t) => t != null)); + let tasks = getTasks(); + input.remove.split(" ").forEach((i) => { + if (!tasks[i - 1]) throw new Error("Index not found."); + tasks[i - 1] = null; + }); + writeFile(tasks.filter((t) => t != null)); } function mod(input = {}) { - let tasks = getTasks(); + let tasks = getTasks(); - if (isNaN(Number(input.mod)) || !tasks[Number(input.mod) - 1]) - throw new Error("Index not found."); + if (isNaN(Number(input.mod)) || !tasks[Number(input.mod) - 1]) + throw new Error("Index not found."); - let task = tasks[Number(input.mod) - 1]; - if (input.title) task.title = input.title; - if (input.date) task.date = new Date().fromString(input.date); - if (input.desc) task.desc = input.desc; - tasks.sort((a, b) => a.date.compare(b.date)); - writeFile(tasks); + let task = tasks[Number(input.mod) - 1]; + if (input.title) task.title = input.title; + if (input.date) task.date = new Date().fromString(input.date); + if (input.desc) task.desc = input.desc; + tasks.sort((a, b) => a.date.compare(b.date)); + writeFile(tasks); } function printTasks(input = {}) { - let width = input.terminal_width || TERMINAL_WIDTH; - let sepLine = "", - sepSpace = ""; - for (let i = 0; i < width; i++) { - sepLine += "─"; - sepSpace += " "; - } - let tasks = getTasks(); - - print(""); - print(` ╭${sepLine.substring(3)}╮`); - print(` │ Deadline Task${sepSpace.substring(27)}│`); - print(` ├${sepLine.substring(3)}┤`); - for (let i = 0; i < tasks.length; ++i) { - let title = tasks[i].title; - let date = tasks[i].date.toString(); - let w = width - 24; - - print( - ` │ ${date} ${i + 1}.${i < 9 ? " " : ""} ${title.substring( - 0, - w, - )}${sepSpace.substring(title.length + 24)} │`, - ); - - // line break if title exceeds width - title = title.substring(w); - for (let i = 0; i < Math.floor(title.length / w) + 1; ++i) { - if (title[i * w] === " ") - //dont start line with space - title = title.substring(0, i * w - 1) + title.substring(i * w); - - let line = title.substring(i * w, (i + 1) * w); - let spaceBefore = sepSpace.substring(0, width - w - 6); - if (line !== "") - print( - ` │ ${spaceBefore} ${line}${sepSpace.substring( - spaceBefore.length + line.length + 6, - )} │`, - ); - } - } - print(` ╰${sepLine.substring(3)}╯`); + let width = input.terminal_width || TERMINAL_WIDTH; + let sepLine = "", + sepSpace = ""; + for (let i = 0; i < width; i++) { + sepLine += "─"; + sepSpace += " "; + } + let tasks = getTasks(); + + print(""); + print(` ╭${sepLine.substring(3)}╮`); + print(` │ Deadline Task${sepSpace.substring(27)}│`); + print(` ├${sepLine.substring(3)}┤`); + for (let i = 0; i < tasks.length; ++i) { + let title = tasks[i].title; + let date = tasks[i].date.toString(); + let w = width - 24; + + print( + ` │ ${date} ${i + 1}.${i < 9 ? " " : ""} ${title.substring( + 0, + w, + )}${sepSpace.substring(title.length + 24)} │`, + ); + + // line break if title exceeds width + title = title.substring(w); + for (let i = 0; i < Math.floor(title.length / w) + 1; ++i) { + if (title[i * w] === " ") + //dont start line with space + title = title.substring(0, i * w - 1) + title.substring(i * w); + + let line = title.substring(i * w, (i + 1) * w); + let spaceBefore = sepSpace.substring(0, width - w - 6); + if (line !== "") + print( + ` │ ${spaceBefore} ${line}${sepSpace.substring( + spaceBefore.length + line.length + 6, + )} │`, + ); + } + } + print(` ╰${sepLine.substring(3)}╯`); } function eww() { - let out = [], - id = 1; - let tasks = getTasks(); - tasks.forEach((t) => (t.id = id++)); - tasks - .filter((t) => t.date.month || t.date.day || t.date.hour || t.date.asap) - .forEach((t) => - out.push({ - asap: t.date.asap || t.date.isLate(), - date: t.date.toString(), - title: t.title, - id: t.id, - }), - ); - - print(JSON.stringify(out, null, 3)); + let out = [], + id = 1; + let tasks = getTasks(); + tasks.forEach((t) => (t.id = id++)); + tasks + .filter((t) => t.date.month || t.date.day || t.date.hour || t.date.asap) + .forEach((t) => + out.push({ + asap: t.date.asap || t.date.isLate(), + date: t.date.toString(), + title: t.title, + id: t.id, + }), + ); + + print(JSON.stringify(out, null, 3)); } function getDesc(input = {}) { - let tasks = getTasks(); - if (!tasks[input.get_desc - 1]) throw new Error("Index not found."); - - let width = input.terminal_width || TERMINAL_WIDTH; - let sepLine = "", - sepSpace = ""; - for (let i = 0; i < width; i++) { - sepLine += "─"; - sepSpace += " "; - } - - let title = tasks[input.get_desc - 1].title; - let desc = - tasks[input.get_desc - 1].desc || "No description for this task."; - print(""); - print(` ╭${sepLine.substring(3)}╮`); - print(` │ ${title}${sepSpace.substring(title.length + 4)}│`); - print(` ├${sepLine.substring(3)}┤`); - - let w = width - 5; - for (let i = 0; i < Math.floor(desc.length / w) + 1; ++i) { - if (desc[i * w] === " ") - //dont start line with space - desc = desc.substring(0, i * w - 1) + desc.substring(i * w); - - let line = desc.substring(i * w, (i + 1) * w); - print(` │ ${line}${sepSpace.substring(line.length + 4)}│`); - } - print(` ╰${sepLine.substring(3)}╯`); + let tasks = getTasks(); + if (!tasks[input.get_desc - 1]) throw new Error("Index not found."); + + let width = input.terminal_width || TERMINAL_WIDTH; + let sepLine = "", + sepSpace = ""; + for (let i = 0; i < width; i++) { + sepLine += "─"; + sepSpace += " "; + } + + let title = tasks[input.get_desc - 1].title; + let desc = tasks[input.get_desc - 1].desc || "No description for this task."; + print(""); + print(` ╭${sepLine.substring(3)}╮`); + print(` │ ${title}${sepSpace.substring(title.length + 4)}│`); + print(` ├${sepLine.substring(3)}┤`); + + let w = width - 5; + for (let i = 0; i < Math.floor(desc.length / w) + 1; ++i) { + if (desc[i * w] === " ") + //dont start line with space + desc = desc.substring(0, i * w - 1) + desc.substring(i * w); + + let line = desc.substring(i * w, (i + 1) * w); + print(` │ ${line}${sepSpace.substring(line.length + 4)}│`); + } + print(` ╰${sepLine.substring(3)}╯`); } function main() { - if (!ARGV[0]) return printTasks(); - - let input = {}; - - for (let i = 0; i < ARGV.length; ++i) { - let arg = []; - let cmd = ARGV[i]; - for (let j = i + 1; j < ARGV.length && ARGV[j][0] !== "-"; ++j) - arg.push(ARGV[j]); - - switch (cmd) { - case "--eww": - input.eww = true; - break; - case "-m": - input.mod = arg.join(" "); - break; - case "--mod": - input.mod = arg.join(" "); - break; - case "-t": - input.title = arg.join(" "); - break; - case "--title": - input.title = arg.join(" "); - break; - case "-a": - input.title = arg.join(" "); - break; - case "--add": - input.title = arg.join(" "); - break; - case "-D": - input.desc = arg.join(" "); - break; - case "--description": - input.desc = arg.join(" "); - break; - case "--desc": - input.desc = arg.join(" "); - break; - case "-d": - input.date = arg.join(" "); - break; - case "--date": - input.date = arg.join(" "); - break; - case "--due": - input.date = arg.join(" "); - break; - case "-r": - input.remove = arg.join(" "); - break; - case "--remove": - input.remove = arg.join(" "); - break; - case "--rem": - input.remove = arg.join(" "); - break; - case "-w": - input.terminal_width = arg.join(" "); - break; - case "--width": - input.terminal_width = arg.join(" "); - break; - case "-w": - input.terminal_width = arg.join(" "); - break; - case "--width": - input.terminal_width = arg.join(" "); - break; - case "-g": - input.get_desc = arg.join(" "); - break; - case "--get-desc": - input.get_desc = arg.join(" "); - break; - default: - input.title = cmd + " " + arg.join(" "); - break; - } - i += arg.length; - } - - if (input.remove) remove(input); - else if (input.mod) mod(input); - else if (input.eww) eww(); - else if (input.get_desc) getDesc(input); - else if (input.title) add(input); - - if (!input.eww && !input.get_desc) printTasks(input); + if (!ARGV[0]) return printTasks(); + + let input = {}; + + for (let i = 0; i < ARGV.length; ++i) { + let arg = []; + let cmd = ARGV[i]; + for (let j = i + 1; j < ARGV.length && ARGV[j][0] !== "-"; ++j) + arg.push(ARGV[j]); + + switch (cmd) { + case "--eww": + input.eww = true; + break; + case "-m": + input.mod = arg.join(" "); + break; + case "--mod": + input.mod = arg.join(" "); + break; + case "-t": + input.title = arg.join(" "); + break; + case "--title": + input.title = arg.join(" "); + break; + case "-a": + input.title = arg.join(" "); + break; + case "--add": + input.title = arg.join(" "); + break; + case "-D": + input.desc = arg.join(" "); + break; + case "--description": + input.desc = arg.join(" "); + break; + case "--desc": + input.desc = arg.join(" "); + break; + case "-d": + input.date = arg.join(" "); + break; + case "--date": + input.date = arg.join(" "); + break; + case "--due": + input.date = arg.join(" "); + break; + case "-r": + input.remove = arg.join(" "); + break; + case "--remove": + input.remove = arg.join(" "); + break; + case "--rem": + input.remove = arg.join(" "); + break; + case "-w": + input.terminal_width = arg.join(" "); + break; + case "--width": + input.terminal_width = arg.join(" "); + break; + case "-w": + input.terminal_width = arg.join(" "); + break; + case "--width": + input.terminal_width = arg.join(" "); + break; + case "-g": + input.get_desc = arg.join(" "); + break; + case "--get-desc": + input.get_desc = arg.join(" "); + break; + default: + input.title = cmd + " " + arg.join(" "); + break; + } + i += arg.length; + } + + if (input.remove) remove(input); + else if (input.mod) mod(input); + else if (input.eww) eww(); + else if (input.get_desc) getDesc(input); + else if (input.title) add(input); + + if (!input.eww && !input.get_desc) printTasks(input); } main(); diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/common.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/common.scss index a8ed1e49..7132729e 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/common.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/common.scss @@ -1,162 +1,156 @@ @mixin widget($radii: $widget_radius) { - border-radius: $radii; - color: $fg_color; - background-color: $widget_bg; - box-shadow: inset 0 0 0 $border_width $border_color; + border-radius: $radii; + color: $fg_color; + background-color: $widget_bg; + box-shadow: inset 0 0 0 $border_width $border_color; } @mixin button( - $flat: false, - $interactive: true, - $radii: $radii, - $focusable: false + $flat: false, + $interactive: true, + $radii: $radii, + $focusable: false ) { - border-radius: $radii; - color: $fg_color; - - @if $flat { - background-color: transparent; - background-image: none; - box-shadow: none; - } @else { - background-color: $button_bg; - box-shadow: inset 0 0 0 $border_width $border_color; - } - - @if $interactive { - @if $focusable { - &:focus { - box-shadow: inset 0 0 0 $border_width $accent; - background-color: $hover; - color: $hover_fg; - } - } - - &:hover { - box-shadow: inset 0 0 0 $border_width $border_color; - background-color: $hover; - color: $hover_fg; - } - - &:active { - box-shadow: inset 0 0 0 $border_width $border_color; - background-color: $accent; - color: $accent_fg; - } - } + border-radius: $radii; + color: $fg_color; + + @if $flat { + background-color: transparent; + background-image: none; + box-shadow: none; + } @else { + background-color: $button_bg; + box-shadow: inset 0 0 0 $border_width $border_color; + } + + @if $interactive { + @if $focusable { + &:focus { + box-shadow: inset 0 0 0 $border_width $accent; + background-color: $hover; + color: $hover_fg; + } + } + + &:hover { + box-shadow: inset 0 0 0 $border_width $border_color; + background-color: $hover; + color: $hover_fg; + } + + &:active { + box-shadow: inset 0 0 0 $border_width $border_color; + background-color: $accent; + color: $accent_fg; + } + } } @mixin floating_widget($shadow: true, $padding: $popover_padding) { - @if $shadow { - box-shadow: - 0 0 5px 0 rgba(0, 0, 0, 0.6), - inset 0 0 0 $border_width $popover_border_color; - } @else { - box-shadow: inset 0 0 0 $border_width $popover_border_color; - } - - border-radius: $popover_radius; - margin: $wm_gaps; - background-color: $bg_color; - color: $fg_color; - padding: $padding; + @if $shadow { + box-shadow: + 0 0 5px 0 rgba(0, 0, 0, 0.6), + inset 0 0 0 $border_width $popover_border_color; + } @else { + box-shadow: inset 0 0 0 $border_width $popover_border_color; + } + + border-radius: $popover_radius; + margin: $wm_gaps; + background-color: $bg_color; + color: $fg_color; + padding: $padding; } @mixin slider( - $width: 0.4em, - $color: $accent, - $slider: true, - $focusable: false + $width: 0.4em, + $color: $accent, + $slider: true, + $focusable: false ) { - trough { - border-radius: $button_radius; - border: $border; - background-color: $button_bg; - min-height: $width; - min-width: $width; - - highlight, - progress { - border-radius: $popover_radius * 0.8; - background-color: $color; - min-height: $width; - min-width: $width; - } - - slider { - @if $slider { - background-color: $fg_color; - border-radius: $button_radius; - border: $border; - min-height: $width; - min-width: $width; - } - } - } - - &:hover trough { - background-color: $hover; - } - - @if $focusable { - trough:focus { - background-color: $hover; - box-shadow: inset 0 0 0 $border_width $accent; - - highlight, - progress { - background-color: transparentize($color, 0.3); - } - } - } + trough { + border-radius: $button_radius; + border: $border; + background-color: $button_bg; + min-height: $width; + min-width: $width; + + highlight, + progress { + border-radius: $popover_radius * 0.8; + background-color: $color; + min-height: $width; + min-width: $width; + } + + slider { + @if $slider { + background-color: $fg_color; + border-radius: $button_radius; + border: $border; + min-height: $width; + min-width: $width; + } + } + } + + &:hover trough { + background-color: $hover; + } + + @if $focusable { + trough:focus { + background-color: $hover; + box-shadow: inset 0 0 0 $border_width $accent; + + highlight, + progress { + background-color: transparentize($color, 0.3); + } + } + } } @mixin darkened($radii: 0) { - border-radius: $radii * 0.99; + border-radius: $radii * 0.99; - @if $theme == "dark" { - box-shadow: inset 0 0 3em 1em transparentize($bg_color, 0.1); - } + @if $theme == "dark" { + box-shadow: inset 0 0 3em 1em transparentize($bg_color, 0.1); + } - @if $theme == "light" { - background-color: transparentize($bg_color, 0.5); - } + @if $theme == "light" { + background-color: transparentize($bg_color, 0.5); + } } @mixin tooltip { - > * > * { - background-color: $bg_color; - border-radius: $button_radius; - border: $border_width solid $popover_border_color; - color: $fg_color; - padding: 8px; - margin: 4px; - box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4); - } + > * > * { + background-color: $bg_color; + border-radius: $button_radius; + border: $border_width solid $popover_border_color; + color: $fg_color; + padding: 8px; + margin: 4px; + box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4); + } } @mixin scrollbar { - scrollbar.vertical { - slider { - background: $widget_bg; - border-radius: $radii; - min-width: 0.6em; - min-height: 2em; - } - } - overshoot { - border-radius: $radii; - &.top { - background: linear-gradient( - transparentize($bg_color, 0.6), - transparent - ); - } - &.bottom { - background: linear-gradient( - transparent, - transparentize($bg_color, 0.6) - ); - } - } + scrollbar.vertical { + slider { + background: $widget_bg; + border-radius: $radii; + min-width: 0.6em; + min-height: 2em; + } + } + overshoot { + border-radius: $radii; + &.top { + background: linear-gradient(transparentize($bg_color, 0.6), transparent); + } + &.bottom { + background: linear-gradient(transparent, transparentize($bg_color, 0.6)); + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/variables.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/variables.scss index c1fdadb5..0d6d4754 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/variables.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/variables.scss @@ -31,10 +31,10 @@ $popover_border_color: rgba(255, 255, 255, 0.02); $popover_padding: 14px; * { - all: unset; - font-size: 14px; - font-family: "Ubuntu Nerd Font"; - transition: 200ms; + all: unset; + font-size: 14px; + font-family: "Ubuntu Nerd Font"; + transition: 200ms; } $mono_font: "mononoki Nerd Font"; diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/bar_widget.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/bar_widget.scss index 691410b5..512f6b1e 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/bar_widget.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/bar_widget.scss @@ -1,102 +1,102 @@ @mixin system-indicators($orientation) { - @include button($flat: false, $radii: $panel_button_radius); - .reveal { - @if $orientation == "v" { - padding-top: 0.5em; - } - @if $orientation == "h" { - padding-left: 0.2em; - } - } - .slider { - @include slider($width: 1em, $slider: false); - @if $orientation == "v" { - > * { - min-height: 80px; - } - } - @if $orientation == "h" { - > * { - min-width: 90px; - } - } - } - .icon { - margin: 0.1em 0; - &.battery { - &.low { - color: $destructive; - } - &.charging { - color: $succes; - } - &.charged { - color: $succes; - } - } - &.notifications.active { - color: $yellow; - } - &.network { - &.none, - &.low { - color: $red; - } - &.medium { - } - &.high { - color: $blue; - } - } - &.bluetooth, - &.bt_speaker { - color: $blue; - } - } + @include button($flat: false, $radii: $panel_button_radius); + .reveal { + @if $orientation == "v" { + padding-top: 0.5em; + } + @if $orientation == "h" { + padding-left: 0.2em; + } + } + .slider { + @include slider($width: 1em, $slider: false); + @if $orientation == "v" { + > * { + min-height: 80px; + } + } + @if $orientation == "h" { + > * { + min-width: 90px; + } + } + } + .icon { + margin: 0.1em 0; + &.battery { + &.low { + color: $destructive; + } + &.charging { + color: $succes; + } + &.charged { + color: $succes; + } + } + &.notifications.active { + color: $yellow; + } + &.network { + &.none, + &.low { + color: $red; + } + &.medium { + } + &.high { + color: $blue; + } + } + &.bluetooth, + &.bt_speaker { + color: $blue; + } + } } @mixin panel_media() { - .player { - @include button($flat: true, $radii: $panel_button_radius); - } - .controls { - @include button($radii: $panel_button_radius); - button { - &.prev, - &.next, - &.play-pause { - color: transparentize($fg_color, 0.3); - &:hover { - color: transparentize($fg_color, 0.15); - } - &:active { - color: $fg_color; - } - } - } - } - .icon { - &.spotify { - color: $green; - } - &.firefox { - color: $orange; - } - &.mpv { - color: $magenta; - } - } + .player { + @include button($flat: true, $radii: $panel_button_radius); + } + .controls { + @include button($radii: $panel_button_radius); + button { + &.prev, + &.next, + &.play-pause { + color: transparentize($fg_color, 0.3); + &:hover { + color: transparentize($fg_color, 0.15); + } + &:active { + color: $fg_color; + } + } + } + } + .icon { + &.spotify { + color: $green; + } + &.firefox { + color: $orange; + } + &.mpv { + color: $magenta; + } + } } @mixin workspaces() { - @include button($flat: false, $radii: $panel_button_radius); - .workspace-btn { - color: $fg_color; - .focus { - color: $accent; - } - &:hover { - color: darken($fg_color, 0.3); - } - } + @include button($flat: false, $radii: $panel_button_radius); + .workspace-btn { + color: $fg_color; + .focus { + color: $accent; + } + &:hover { + color: darken($fg_color, 0.3); + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/calendar.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/calendar.scss index 6f79c209..41ea8cbb 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/calendar.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/calendar.scss @@ -1,31 +1,31 @@ @mixin calendar() { - calendar { - &.button { - @include button($flat: true); - margin: 1em; - } + calendar { + &.button { + @include button($flat: true); + margin: 1em; + } - &:selected { - border: 2px solid $accent; - border-radius: $button_radius; - } + &:selected { + border: 2px solid $accent; + border-radius: $button_radius; + } - &.header { - background-color: transparent; - border: none; - color: transparentize($fg_color, 0.5); - } + &.header { + background-color: transparent; + border: none; + color: transparentize($fg_color, 0.5); + } - &.highlight { - background-color: transparent; - color: transparentize($accent, 0.5); - } + &.highlight { + background-color: transparent; + color: transparentize($accent, 0.5); + } - &:indeterminate { - color: transparentize($fg_color, 0.9); - } + &:indeterminate { + color: transparentize($fg_color, 0.9); + } - font-size: 1.2em; - padding: 0.2em; - } + font-size: 1.2em; + padding: 0.2em; + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/events.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/events.scss index 7590101b..b716e7dc 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/events.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/events.scss @@ -1,49 +1,49 @@ @mixin events { - label { - font-size: 1.1em; - } - - .title-box { - padding: $spacing; - border-bottom: 1px solid transparentize($fg_color, 0.9); - - label { - font-size: 1.1em; - } - } - - .events-box { - padding: $spacing; - } - - .event { - .deadline { - color: transparentize($fg_color, 0.5); - font-family: $mono_font; - } - - &.done { - label { - text-decoration: line-through; - } - - .title { - color: $green; - } - - .deadline { - color: transparentize($green, 0.5); - } - } - - &.upcoming { - .title { - color: $red; - } - - .deadline { - color: transparentize($red, 0.5); - } - } - } + label { + font-size: 1.1em; + } + + .title-box { + padding: $spacing; + border-bottom: 1px solid transparentize($fg_color, 0.9); + + label { + font-size: 1.1em; + } + } + + .events-box { + padding: $spacing; + } + + .event { + .deadline { + color: transparentize($fg_color, 0.5); + font-family: $mono_font; + } + + &.done { + label { + text-decoration: line-through; + } + + .title { + color: $green; + } + + .deadline { + color: transparentize($green, 0.5); + } + } + + &.upcoming { + .title { + color: $red; + } + + .deadline { + color: transparentize($red, 0.5); + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/media.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/media.scss index c640a143..36452d95 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/media.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/media.scss @@ -1,150 +1,150 @@ @mixin media($style: "widget", $height: 12em) { - @if $style == "widget" { - @include widget; - } - @if $style == "popover" { - @include floating_widget; - } - border-radius: $radii; - margin: $spacing; - min-height: $height; - padding: 0; - text-shadow: $text_shadow; - .cover { - @if $style == "widget" { - @include widget; - } - @if $style == "popover" { - border-radius: $radii; - } - background-size: cover; - background-position: center; - .darkened { - @if $style == "widget" { - @include darkened($radii: $button_radius); - } - @if $style == "popover" { - @include darkened($radii: $radii); - } - } - .slider { - @include slider( - $width: 0.4em, - $slider: false, - $color: transparentize($fg_color, 0.3) - ); - scale > contents { - trough { - border-radius: 0; - border: 0; - highlight { - border-radius: 0; - } - } - } - } - .box { - margin: $spacing; - } - .artist { - font-size: 1.2em; - } - .title, - .position { - color: transparentize($fg_color, 0.2); - } - .icon.player { - font-size: 1.4em; - margin-left: 0.6em; - } - .controls { - margin: $spacing; - button { - label { - font-size: 2em; - } - &.loop, - &.shuffle { - label { - font-size: 1.2em; - } - } - color: transparentize($fg_color, 0.3); - &:hover { - color: $fg_color; - } - &.active { - color: $accent; - } - &.inactive { - color: transparentize($fg_color, 0.7); - text-shadow: none; - } - &.loop { - &.Playlist { - color: transparentize($accent, 0.2); - } - &.Track { - color: $accent; - } - } - } - } - } - .sidebar { - .slider { - @include slider($width: 0.6em, $slider: false); - } - margin: $spacing * 2; - } + @if $style == "widget" { + @include widget; + } + @if $style == "popover" { + @include floating_widget; + } + border-radius: $radii; + margin: $spacing; + min-height: $height; + padding: 0; + text-shadow: $text_shadow; + .cover { + @if $style == "widget" { + @include widget; + } + @if $style == "popover" { + border-radius: $radii; + } + background-size: cover; + background-position: center; + .darkened { + @if $style == "widget" { + @include darkened($radii: $button_radius); + } + @if $style == "popover" { + @include darkened($radii: $radii); + } + } + .slider { + @include slider( + $width: 0.4em, + $slider: false, + $color: transparentize($fg_color, 0.3) + ); + scale > contents { + trough { + border-radius: 0; + border: 0; + highlight { + border-radius: 0; + } + } + } + } + .box { + margin: $spacing; + } + .artist { + font-size: 1.2em; + } + .title, + .position { + color: transparentize($fg_color, 0.2); + } + .icon.player { + font-size: 1.4em; + margin-left: 0.6em; + } + .controls { + margin: $spacing; + button { + label { + font-size: 2em; + } + &.loop, + &.shuffle { + label { + font-size: 1.2em; + } + } + color: transparentize($fg_color, 0.3); + &:hover { + color: $fg_color; + } + &.active { + color: $accent; + } + &.inactive { + color: transparentize($fg_color, 0.7); + text-shadow: none; + } + &.loop { + &.Playlist { + color: transparentize($accent, 0.2); + } + &.Track { + color: $accent; + } + } + } + } + } + .sidebar { + .slider { + @include slider($width: 0.6em, $slider: false); + } + margin: $spacing * 2; + } - &.spotify { - .icon.player { - color: $green; - } - .sidebar .slider { - @include slider($width: 0.6em, $slider: false, $color: $green); - } - .controls button { - &.active { - color: $green; - } - &.loop { - &.Playlist { - color: transparentize($green, 0.2); - } - &.Track { - color: $green; - } - } - } - } + &.spotify { + .icon.player { + color: $green; + } + .sidebar .slider { + @include slider($width: 0.6em, $slider: false, $color: $green); + } + .controls button { + &.active { + color: $green; + } + &.loop { + &.Playlist { + color: transparentize($green, 0.2); + } + &.Track { + color: $green; + } + } + } + } - &.firefox { - .icon.player { - color: $orange; - } - } + &.firefox { + .icon.player { + color: $orange; + } + } - &.mpv { - .icon.player { - color: $magenta; - } - .sidebar .slider { - @include slider($width: 0.6em, $slider: false, $color: $magenta); - } - .controls button { - &.active { - color: $magenta; - } - &.loop { - &.Playlist { - color: transparentize($magenta, 0.2); - } - &.Track { - color: $magenta; - } - } - } - } + &.mpv { + .icon.player { + color: $magenta; + } + .sidebar .slider { + @include slider($width: 0.6em, $slider: false, $color: $magenta); + } + .controls button { + &.active { + color: $magenta; + } + &.loop { + &.Playlist { + color: transparentize($magenta, 0.2); + } + &.Track { + color: $magenta; + } + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/notification.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/notification.scss index 5d779bb7..adabd819 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/notification.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/notification.scss @@ -1,56 +1,56 @@ @mixin notification() { - .notification-content { - padding: $popover_padding; - .title { - font-size: 1.2em; - font-weight: 600; - margin-bottom: $popover_padding/2; - } - .image { - min-width: 80px; - min-height: 80px; - background-size: cover; - margin-right: $popover_padding; - border-radius: $button_radius; - } - .action-button { - @include button; - font-size: 1.1em; - font-weight: 500; - padding: 0.5em; - margin-top: $popover_padding; - &:first-child { - margin-right: $popover_padding/2; - } - &:last-child { - margin-left: $popover_padding/2; - } - &:first-child:last-child { - margin-left: 0; - margin-right: 0; - } - } - .close-button { - min-width: 1.4em; - min-height: 1.4em; - } - .time { - color: transparentize($fg_color, 0.4); - margin-right: 0.4em; - } - } - &:hover { - .notification-content { - .close-button { - @include button; - background-color: transparentize($red, 0.5); - &:hover { - background-color: transparentize($red, 0.3); - } - &:active { - background-color: transparentize($red, 0.1); - } - } - } - } + .notification-content { + padding: $popover_padding; + .title { + font-size: 1.2em; + font-weight: 600; + margin-bottom: $popover_padding/2; + } + .image { + min-width: 80px; + min-height: 80px; + background-size: cover; + margin-right: $popover_padding; + border-radius: $button_radius; + } + .action-button { + @include button; + font-size: 1.1em; + font-weight: 500; + padding: 0.5em; + margin-top: $popover_padding; + &:first-child { + margin-right: $popover_padding/2; + } + &:last-child { + margin-left: $popover_padding/2; + } + &:first-child:last-child { + margin-left: 0; + margin-right: 0; + } + } + .close-button { + min-width: 1.4em; + min-height: 1.4em; + } + .time { + color: transparentize($fg_color, 0.4); + margin-right: 0.4em; + } + } + &:hover { + .notification-content { + .close-button { + @include button; + background-color: transparentize($red, 0.5); + &:hover { + background-color: transparentize($red, 0.3); + } + &:active { + background-color: transparentize($red, 0.1); + } + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/sys_sliders.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/sys_sliders.scss index d9f57297..0b4ca998 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/sys_sliders.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/sys_sliders.scss @@ -1,22 +1,22 @@ @mixin sys-sliders() { - .slider { - @include slider($width: 0.8em, $slider: false); - } - .percent { - margin: $spacing; - min-width: 2.6em; - } - .icon { - margin: $spacing; - &:first-child { - font-size: 1.4em; - } - } - button { - @include button($flat: true); - margin-right: $spacing; - .icon { - margin: 0; - } - } + .slider { + @include slider($width: 0.8em, $slider: false); + } + .percent { + margin: $spacing; + min-width: 2.6em; + } + .icon { + margin: $spacing; + &:first-child { + font-size: 1.4em; + } + } + button { + @include button($flat: true); + margin-right: $spacing; + .icon { + margin: 0; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/toggle_button.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/toggle_button.scss index e211e15f..95d1a7a4 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/toggle_button.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/toggle_button.scss @@ -1,50 +1,50 @@ @mixin toggle_button($toggle_radius: $radii * 2.4) { - @include button($radii: $toggle_radius); - &.small { - @include button($radii: $toggle_radius * 1.1); - } - margin: $spacing; - .separator { - background-color: $fg_color; - min-width: 2px; - min-height: 1.4em; - } - .half { - @include button($flat: true); - min-height: 3.4em; - &:first-child { - border-radius: $toggle_radius 0 0 $toggle_radius; - } - &:last-child { - border-radius: 0 $toggle_radius $toggle_radius 0; - } - &:hover { - background-color: $hover; - } - } - &.active { - * { - color: $accent_fg; - } - background-color: $accent; - .separator { - background-color: $accent_fg; - } - &:hover { - background-color: transparentize($accent, 0.15); - * { - color: $accent_fg; - } - } - &:focus { - background-color: transparentize($accent, 0.4); - box-shadow: inset 0 0 0 $border_width * 2 $accent; - } - } - .icon { - font-size: 2em; - &.arrow { - font-size: 1.8em; - } - } + @include button($radii: $toggle_radius); + &.small { + @include button($radii: $toggle_radius * 1.1); + } + margin: $spacing; + .separator { + background-color: $fg_color; + min-width: 2px; + min-height: 1.4em; + } + .half { + @include button($flat: true); + min-height: 3.4em; + &:first-child { + border-radius: $toggle_radius 0 0 $toggle_radius; + } + &:last-child { + border-radius: 0 $toggle_radius $toggle_radius 0; + } + &:hover { + background-color: $hover; + } + } + &.active { + * { + color: $accent_fg; + } + background-color: $accent; + .separator { + background-color: $accent_fg; + } + &:hover { + background-color: transparentize($accent, 0.15); + * { + color: $accent_fg; + } + } + &:focus { + background-color: transparentize($accent, 0.4); + box-shadow: inset 0 0 0 $border_width * 2 $accent; + } + } + .icon { + font-size: 2em; + &.arrow { + font-size: 1.8em; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/user.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/user.scss index c3582bbb..7cabdd57 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/user.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/user.scss @@ -1,26 +1,26 @@ @mixin user($width: 10em, $height: 10em) { - padding: 0; - min-height: 10em; - min-width: 10em; - background-image: url($avatar); - background-size: cover; + padding: 0; + min-height: 10em; + min-width: 10em; + background-image: url($avatar); + background-size: cover; - .darkened { - @include darkened($radii: $button_radius); - padding: 0.3em; + .darkened { + @include darkened($radii: $button_radius); + padding: 0.3em; - label { - text-shadow: $text_shadow; + label { + text-shadow: $text_shadow; - &:first-child { - color: transparentize($fg_color, 0.1); - font-size: 1.3em; - } + &:first-child { + color: transparentize($fg_color, 0.1); + font-size: 1.3em; + } - &:last-child { - color: transparentize($fg_color, 0.3); - font-size: 1.1em; - } - } - } + &:last-child { + color: transparentize($fg_color, 0.3); + font-size: 1.1em; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/weather.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/weather.scss index 97765577..d8b253ae 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/weather.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/widgets/weather.scss @@ -1,50 +1,50 @@ @mixin weather { - .info { - .place { - label { - font-size: 1.2em; - } - .icon { - font-size: 0.9em; - margin-right: 0.2em; - color: transparentize($accent, 0); - } - } - .feels { - color: transparentize($fg_color, 0.3); - } - .temp { - font-size: 1.2em; - } - } - .icon { - font-size: 2.6em; + .info { + .place { + label { + font-size: 1.2em; + } + .icon { + font-size: 0.9em; + margin-right: 0.2em; + color: transparentize($accent, 0); + } + } + .feels { + color: transparentize($fg_color, 0.3); + } + .temp { + font-size: 1.2em; + } + } + .icon { + font-size: 2.6em; - &.clear.d { - color: transparentize($yellow, 0.6); - } - &.clear.n { - color: transparentize($blue, 0.6); - } + &.clear.d { + color: transparentize($yellow, 0.6); + } + &.clear.n { + color: transparentize($blue, 0.6); + } - &.clouds.d { - color: transparentize($fg_color, 0.6); - } - &.clouds.n { - color: transparentize($blue, 0.6); - } + &.clouds.d { + color: transparentize($fg_color, 0.6); + } + &.clouds.n { + color: transparentize($blue, 0.6); + } - &.rain { - color: transparentize($blue, 0.6); - } - &.thunderstorm { - color: transparentize($yellow, 0.6); - } - &.snow { - color: transparentize($fg_color, 0.6); - } - &.mist { - color: transparentize($teal, 0.6); - } - } + &.rain { + color: transparentize($blue, 0.6); + } + &.thunderstorm { + color: transparentize($yellow, 0.6); + } + &.snow { + color: transparentize($fg_color, 0.6); + } + &.mist { + color: transparentize($teal, 0.6); + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/app_laucher.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/app_laucher.scss index 94eea77f..c8e066d6 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/app_laucher.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/app_laucher.scss @@ -1,58 +1,58 @@ .app-launcher { - @include floating_widget; - min-height: 530px; - min-width: 530px; - padding: 3em; + @include floating_widget; + min-height: 530px; + min-width: 530px; + padding: 3em; - .search { - min-height: 1.4em; - padding: 2em; - border-radius: $radii; - background-image: url($wallpaper); - background-size: cover; - background-position: right bottom; - margin-bottom: 3em; - .icon, - .input { - @include button; - background-color: transparentize($bg_color, 0.1); - box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4); - } - .icon { - min-width: 2.4em; - margin-right: $spacing; - } - .input { - padding: 0.6em 0.8em; - } - } + .search { + min-height: 1.4em; + padding: 2em; + border-radius: $radii; + background-image: url($wallpaper); + background-size: cover; + background-position: right bottom; + margin-bottom: 3em; + .icon, + .input { + @include button; + background-color: transparentize($bg_color, 0.1); + box-shadow: 0 0 5px 0 rgba(0, 0, 0, 0.4); + } + .icon { + min-width: 2.4em; + margin-right: $spacing; + } + .input { + padding: 0.6em 0.8em; + } + } - .separator { - min-height: 1px; - background-color: transparentize($fg_color, 0.94); - margin: 0.2em; - } + .separator { + min-height: 1px; + background-color: transparentize($fg_color, 0.94); + margin: 0.2em; + } - .app { - @include button($flat: true, $focusable: true); - .app-content { - .name { - font-size: 1.1em; - } - .description { - color: transparentize($fg_color, 0.3); - } - .appicon { - background-size: cover; - min-width: 2.4em; - min-height: 2.4em; - margin-right: 1em; - } - padding: 0.6em; - } - } + .app { + @include button($flat: true, $focusable: true); + .app-content { + .name { + font-size: 1.1em; + } + .description { + color: transparentize($fg_color, 0.3); + } + .appicon { + background-size: cover; + min-width: 2.4em; + min-height: 2.4em; + margin-right: 1em; + } + padding: 0.6em; + } + } - .scroll { - @include scrollbar; - } + .scroll { + @include scrollbar; + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/datemenu.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/datemenu.scss index 404cba28..bcbd8a00 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/datemenu.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/datemenu.scss @@ -1,70 +1,70 @@ .datemenu { - @include floating_widget; + @include floating_widget; - .widget { - @include widget; - margin: $spacing; - padding: $spacing; - } + .widget { + @include widget; + margin: $spacing; + padding: $spacing; + } - .clock * { - margin-top: $spacing; - text-shadow: $text_shadow; - font-size: 7em; - } + .clock * { + margin-top: $spacing; + text-shadow: $text_shadow; + font-size: 7em; + } - .uptime { - margin-bottom: $spacing * 2; - font-size: 1.1em; - text-shadow: $text_shadow; - color: transparentize($fg_color, 0.3); - } + .uptime { + margin-bottom: $spacing * 2; + font-size: 1.1em; + text-shadow: $text_shadow; + color: transparentize($fg_color, 0.3); + } - .calendar-bin { - padding: 1em 2em 0.4em 2em; - @include calendar; - } + .calendar-bin { + padding: 1em 2em 0.4em 2em; + @include calendar; + } - .system { - > * { - @include widget; - margin: $spacing; - padding: 5px; - min-width: 3.4em; - min-height: 3.4em; - } - circular-progress { - background-color: $bg_color; - color: $accent; - &.battery { - &.low { - color: $red; - } - } - .icon { - font-size: 1.3em; - } - } - } + .system { + > * { + @include widget; + margin: $spacing; + padding: 5px; + min-width: 3.4em; + min-height: 3.4em; + } + circular-progress { + background-color: $bg_color; + color: $accent; + &.battery { + &.low { + color: $red; + } + } + .icon { + font-size: 1.3em; + } + } + } - .media { - @include media($style: "widget"); - } + .media { + @include media($style: "widget"); + } - .events.widget { - padding: 0; - .events { - @include events; - } - } + .events.widget { + padding: 0; + .events { + @include events; + } + } - .weather { - @include weather; - } + .weather { + @include weather; + } - .wallpaper { - min-height: 13em; - background-image: url($assets + "wallpaper.png"); - background-size: cover; - } + .wallpaper { + min-height: 13em; + background-image: url($assets + "wallpaper.png"); + background-size: cover; + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/desktop.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/desktop.scss index 4be309c2..a7f32f55 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/desktop.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/desktop.scss @@ -1,48 +1,48 @@ .desktop { - background-image: url($wallpaper); - background-size: cover; - - .clock { - color: white; - text-shadow: 4px 4px 4px black; - - .time { - border: 3px solid $fg_color; - box-shadow: inset 0 0 0 3px $bg_color; - border-radius: $popover_radius; - padding: 0.5em 1.3em; - - .hour, - .minutes, - .separator { - font-size: 10em; - font-family: $mono_font; - } - } - - .date { - font-size: 2em; - } - } - - .system { - > * { - padding: 8px; - } - - circular-progress { - background-color: transparentize($bg_color, 0.5); - color: $fg_color; - - &.battery { - &.low { - color: $red; - } - } - - .icon { - font-size: 3em; - } - } - } + background-image: url($wallpaper); + background-size: cover; + + .clock { + color: white; + text-shadow: 4px 4px 4px black; + + .time { + border: 3px solid $fg_color; + box-shadow: inset 0 0 0 3px $bg_color; + border-radius: $popover_radius; + padding: 0.5em 1.3em; + + .hour, + .minutes, + .separator { + font-size: 10em; + font-family: $mono_font; + } + } + + .date { + font-size: 2em; + } + } + + .system { + > * { + padding: 8px; + } + + circular-progress { + background-color: transparentize($bg_color, 0.5); + color: $fg_color; + + &.battery { + &.low { + color: $red; + } + } + + .icon { + font-size: 3em; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/dock.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/dock.scss index 020e07aa..9d3d42fa 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/dock.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/dock.scss @@ -1,76 +1,76 @@ $dock_icon_size: 6em; .dock { - .container { - min-width: $dock_icon_size * 11.5; - min-height: $dock_icon_size * 1.3; - &.hovered { - min-width: $dock_icon_size * 11.7; - } - } + .container { + min-width: $dock_icon_size * 11.5; + min-height: $dock_icon_size * 1.3; + &.hovered { + min-width: $dock_icon_size * 11.7; + } + } - .foot { - @include floating_widget; - margin: 0 1.5em; - padding: 0; - border-radius: $popover_radius $popover_radius 0 0; - border-bottom: none; - min-height: 1.5em; //footer height - } + .foot { + @include floating_widget; + margin: 0 1.5em; + padding: 0; + border-radius: $popover_radius $popover_radius 0 0; + border-bottom: none; + min-height: 1.5em; //footer height + } - .laucher { - .indicator { - min-height: 0.4em; //indicator height - min-width: 2em; //indicator width - border-radius: $button_radius; - } - .icon { - min-width: $dock_icon_size; - min-height: $dock_icon_size; - background-size: contain; - background-repeat: no-repeat; - } - &:hover { - background-image: linear-gradient( - transparent, - transparentize($fg_color, 0.94) - ); - .icon { - min-width: $dock_icon_size * 1.2; - min-height: $dock_icon_size * 1.2; - } - } - &:active { - .indicator { - background-color: $accent; - } - } - &.firefox .icon { - background-image: url($assets + "apps/firefox.png"); - } - &.terminal .icon { - background-image: url($assets + "apps/terminal.png"); - } - &.file-manager .icon { - background-image: url($assets + "apps/file-manager.png"); - } - &.editor .icon { - background-image: url($assets + "apps/editor.png"); - } - &.spotify .icon { - background-image: url($assets + "apps/spotify.png"); - } - &.caprine .icon { - background-image: url($assets + "apps/caprine.png"); - } - &.bitwig .icon { - background-image: url($assets + "apps/bitwig.png"); - } - &.battle .icon { - background-image: url($assets + "apps/battle.png"); - } - &.bottles .icon { - background-image: url($assets + "apps/bottles.png"); - } - } + .laucher { + .indicator { + min-height: 0.4em; //indicator height + min-width: 2em; //indicator width + border-radius: $button_radius; + } + .icon { + min-width: $dock_icon_size; + min-height: $dock_icon_size; + background-size: contain; + background-repeat: no-repeat; + } + &:hover { + background-image: linear-gradient( + transparent, + transparentize($fg_color, 0.94) + ); + .icon { + min-width: $dock_icon_size * 1.2; + min-height: $dock_icon_size * 1.2; + } + } + &:active { + .indicator { + background-color: $accent; + } + } + &.firefox .icon { + background-image: url($assets + "apps/firefox.png"); + } + &.terminal .icon { + background-image: url($assets + "apps/terminal.png"); + } + &.file-manager .icon { + background-image: url($assets + "apps/file-manager.png"); + } + &.editor .icon { + background-image: url($assets + "apps/editor.png"); + } + &.spotify .icon { + background-image: url($assets + "apps/spotify.png"); + } + &.caprine .icon { + background-image: url($assets + "apps/caprine.png"); + } + &.bitwig .icon { + background-image: url($assets + "apps/bitwig.png"); + } + &.battle .icon { + background-image: url($assets + "apps/battle.png"); + } + &.bottles .icon { + background-image: url($assets + "apps/bottles.png"); + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/hbar.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/hbar.scss index 28569f5b..7578ac50 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/hbar.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/hbar.scss @@ -1,113 +1,113 @@ .hpanel { - min-height: 2.2em; - font-weight: bold; - font-size: 1.1em; - color: $fg_color; - background-color: transparent; - border-bottom: $border_width solid $popover_border_color; - box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.8); - - .button-bin { - margin: 3px 2px; - background-color: $bg_color; - border-radius: $button_radius; - - &.launcher { - margin-left: 4px; - } - - &.powermenu { - margin-right: 4px; - } - } - - .button { - .icon { - font-size: 1.2em; - } - - @include button($flat: true, $radii: $panel_button_radius); - - > * { - padding: 0 0.7em; - } - - &.launcher { - color: $accent; - } - - &.powermenu { - color: $red; - } - - &.window { - @include button($flat: true, $interactive: false); - } - - &.workspaces { - @include button($flat: false, $radii: $panel_button_radius); - background-color: $bg_color; - border-radius: $button_radius; - - .workspace-btn { - label { - font-size: 1.2em; - } - - margin: 2px; - - &.empty { - color: transparentize($fg_color, 0.34); - } - - &.occupied { - color: transparentize($fg_color, 0.18); - } - - &.active { - color: $fg_color; - } - - &:hover { - &.empty { - color: transparentize($fg_color, 0.18); - } - - &.occupied { - color: $fg_color; - } - } - - &:active { - color: $accent; - } - } - } - - &.system-indicators { - @include system-indicators($orientation: "h"); - - > * > * > * { - padding: 0 0.3em; - } - } - - &.media { - .icon { - margin-right: 0.2em; - - &.spotify { - color: $green; - } - - &.firefox { - color: $orange; - } - - &.mpv { - color: $magenta; - } - } - } - } + min-height: 2.2em; + font-weight: bold; + font-size: 1.1em; + color: $fg_color; + background-color: transparent; + border-bottom: $border_width solid $popover_border_color; + box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.8); + + .button-bin { + margin: 3px 2px; + background-color: $bg_color; + border-radius: $button_radius; + + &.launcher { + margin-left: 4px; + } + + &.powermenu { + margin-right: 4px; + } + } + + .button { + .icon { + font-size: 1.2em; + } + + @include button($flat: true, $radii: $panel_button_radius); + + > * { + padding: 0 0.7em; + } + + &.launcher { + color: $accent; + } + + &.powermenu { + color: $red; + } + + &.window { + @include button($flat: true, $interactive: false); + } + + &.workspaces { + @include button($flat: false, $radii: $panel_button_radius); + background-color: $bg_color; + border-radius: $button_radius; + + .workspace-btn { + label { + font-size: 1.2em; + } + + margin: 2px; + + &.empty { + color: transparentize($fg_color, 0.34); + } + + &.occupied { + color: transparentize($fg_color, 0.18); + } + + &.active { + color: $fg_color; + } + + &:hover { + &.empty { + color: transparentize($fg_color, 0.18); + } + + &.occupied { + color: $fg_color; + } + } + + &:active { + color: $accent; + } + } + } + + &.system-indicators { + @include system-indicators($orientation: "h"); + + > * > * > * { + padding: 0 0.3em; + } + } + + &.media { + .icon { + margin-right: 0.2em; + + &.spotify { + color: $green; + } + + &.firefox { + color: $orange; + } + + &.mpv { + color: $magenta; + } + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/media.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/media.scss index 0284dcef..8494d467 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/media.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/media.scss @@ -1,10 +1,10 @@ .media-window { - padding: 0; - .media { - @include media($height: 20em, $style: "popover"); - padding: 0; - .cover { - min-width: 20em; - } - } + padding: 0; + .media { + @include media($height: 20em, $style: "popover"); + padding: 0; + .cover { + min-width: 20em; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/noti_center.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/noti_center.scss index 91e66873..9189f5ff 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/noti_center.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/noti_center.scss @@ -1,72 +1,72 @@ .notification-center { - min-width: 400px; - @include floating_widget; + min-width: 400px; + @include floating_widget; - .title { - button { - font-size: 1em; - padding: 0.4em 1em; - @include button; - } + .title { + button { + font-size: 1em; + padding: 0.4em 1em; + @include button; + } - label { - font-size: 1.4em; - } + label { + font-size: 1.4em; + } - margin-bottom: $spacing; - } + margin-bottom: $spacing; + } - .notifications-list { - @include scrollbar; + .notifications-list { + @include scrollbar; - .placeholder { - .icon { - font-size: 8em; - } + .placeholder { + .icon { + font-size: 8em; + } - label { - font-size: 2em; - } - } + label { + font-size: 2em; + } + } - .notification { - @include notification; + .notification { + @include notification; - .notification-content { - @include widget; - margin-bottom: $spacing; - border-radius: $widget_radius * 0.3; - } + .notification-content { + @include widget; + margin-bottom: $spacing; + border-radius: $widget_radius * 0.3; + } - &:first-child .notification-content { - border-radius: $widget_radius $widget_radius $widget_radius * - 0.3 $widget_radius * 0.3; - } + &:first-child .notification-content { + border-radius: $widget_radius $widget_radius $widget_radius * 0.3 + $widget_radius * 0.3; + } - &:last-child .notification-content { - border-radius: $widget_radius * 0.3 $widget_radius * 0.3 - $widget_radius $widget_radius; - } + &:last-child .notification-content { + border-radius: $widget_radius * 0.3 $widget_radius * 0.3 $widget_radius + $widget_radius; + } - &:first-child:last-child .notification-content { - border-radius: $widget_radius; - } - } + &:first-child:last-child .notification-content { + border-radius: $widget_radius; + } + } - margin-bottom: $spacing; - } + margin-bottom: $spacing; + } - .controls { - @include widget; - padding: $popover_padding * 0.5; + .controls { + @include widget; + padding: $popover_padding * 0.5; - .sys-sliders { - @include sys-sliders; - } + .sys-sliders { + @include sys-sliders; + } - .toggle { - min-height: 3.4em; - @include toggle_button($toggle_radius: $radii * 1.4); - } - } + .toggle { + min-height: 3.4em; + @include toggle_button($toggle_radius: $radii * 1.4); + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/notifications.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/notifications.scss index f0225e6d..9467138c 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/notifications.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/notifications.scss @@ -1,9 +1,9 @@ .notifications-window-box { - .notification { - @include notification; - .notification-content { - min-width: 450px; - @include floating_widget; - } - } + .notification { + @include notification; + .notification-content { + min-width: 450px; + @include floating_widget; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/osd.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/osd.scss index 52857009..769ce0b1 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/osd.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/osd.scss @@ -1,18 +1,18 @@ .osd-widget { - @include floating_widget; - padding: 0.3em; - .icon { - font-size: 40px; - color: $accent_fg; - min-width: 30px; - min-height: 30px; - } - .scale { - min-height: 14em; - @include slider($width: 3em); - trough { - background-color: transparent; - border: none; - } - } + @include floating_widget; + padding: 0.3em; + .icon { + font-size: 40px; + color: $accent_fg; + min-width: 30px; + min-height: 30px; + } + .scale { + min-height: 14em; + @include slider($width: 3em); + trough { + background-color: transparent; + border: none; + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/powermenu.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/powermenu.scss index 721d2679..3e903537 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/powermenu.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/powermenu.scss @@ -1,75 +1,75 @@ .background.powermenu { - background-color: rgba(0, 0, 0, 0.5); - .content { - @include floating_widget; - .user { - @include user; - } - .clock { - text-shadow: $text_shadow; - margin-bottom: 2.2em; - .hour * { - font-size: 9em; - } - .date { - font-size: 2em; - } - } - .power-menu { - border-radius: $radii * 3; - padding: 15px; - } - .button-bin { - margin: 15px; - margin-bottom: 0; - .button { - @include button($focusable: true); - border-radius: $radii * 2.4; - font-size: 60px; - min-width: 130px; - min-height: 130px; - .icon { - background-size: contain; - margin: 24px; - @if $theme == "light" { - &.shutdown { - background-image: url($assets + "powermenu/light-shutdown.png"); - } - &.reboot { - background-image: url($assets + "powermenu/light-reboot.png"); - } - &.logout { - background-image: url($assets + "powermenu/light-logout.png"); - } - &.suspend { - background-image: url($assets + "powermenu/light-suspend.png"); - } - &.lock { - background-image: url($assets + "powermenu/light-lock.png"); - } - } @else { - &.shutdown { - background-image: url($assets + "powermenu/shutdown.png"); - } - &.reboot { - background-image: url($assets + "powermenu/reboot.png"); - } - &.logout { - background-image: url($assets + "powermenu/logout.png"); - } - &.suspend { - background-image: url($assets + "powermenu/suspend.png"); - } - &.lock { - background-image: url($assets + "powermenu/lock.png"); - } - } - } - } - .label { - font-size: 20px; - margin: 8px 0; - } - } - } + background-color: rgba(0, 0, 0, 0.5); + .content { + @include floating_widget; + .user { + @include user; + } + .clock { + text-shadow: $text_shadow; + margin-bottom: 2.2em; + .hour * { + font-size: 9em; + } + .date { + font-size: 2em; + } + } + .power-menu { + border-radius: $radii * 3; + padding: 15px; + } + .button-bin { + margin: 15px; + margin-bottom: 0; + .button { + @include button($focusable: true); + border-radius: $radii * 2.4; + font-size: 60px; + min-width: 130px; + min-height: 130px; + .icon { + background-size: contain; + margin: 24px; + @if $theme == "light" { + &.shutdown { + background-image: url($assets + "powermenu/light-shutdown.png"); + } + &.reboot { + background-image: url($assets + "powermenu/light-reboot.png"); + } + &.logout { + background-image: url($assets + "powermenu/light-logout.png"); + } + &.suspend { + background-image: url($assets + "powermenu/light-suspend.png"); + } + &.lock { + background-image: url($assets + "powermenu/light-lock.png"); + } + } @else { + &.shutdown { + background-image: url($assets + "powermenu/shutdown.png"); + } + &.reboot { + background-image: url($assets + "powermenu/reboot.png"); + } + &.logout { + background-image: url($assets + "powermenu/logout.png"); + } + &.suspend { + background-image: url($assets + "powermenu/suspend.png"); + } + &.lock { + background-image: url($assets + "powermenu/lock.png"); + } + } + } + } + .label { + font-size: 20px; + margin: 8px 0; + } + } + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/quicksettings.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/quicksettings.scss index ea749ef6..b049ec3d 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/quicksettings.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/quicksettings.scss @@ -1,66 +1,66 @@ .quick-settings { - @include floating_widget; + @include floating_widget; - .widget { - @include widget; - margin: $spacing; - padding: $spacing; - } + .widget { + @include widget; + margin: $spacing; + padding: $spacing; + } - .sys-sliders { - @include sys-sliders; - } + .sys-sliders { + @include sys-sliders; + } - .sys-actions { - .user { - @include user; - } - .sysactions { - button { - @include button($radii: 40%); - margin: $spacing; - padding: 0.4em; - label { - font-size: 2.4em; - } - &.power { - color: $red; - } - } - .uptime { - font-size: 1.3em; - color: transparentize($fg_color, 0.5); - } - } - } + .sys-actions { + .user { + @include user; + } + .sysactions { + button { + @include button($radii: 40%); + margin: $spacing; + padding: 0.4em; + label { + font-size: 2.4em; + } + &.power { + color: $red; + } + } + .uptime { + font-size: 1.3em; + color: transparentize($fg_color, 0.5); + } + } + } - .system { - > * > * { - @include widget; - margin: $spacing; - padding: 8px; - min-width: 4.4em; - min-height: 4.4em; - } - circular-progress { - background-color: $bg_color; - color: $accent; - &.battery { - &.low { - color: $red; - } - } - .icon { - font-size: 1.8em; - } - } - } + .system { + > * > * { + @include widget; + margin: $spacing; + padding: 8px; + min-width: 4.4em; + min-height: 4.4em; + } + circular-progress { + background-color: $bg_color; + color: $accent; + &.battery { + &.low { + color: $red; + } + } + .icon { + font-size: 1.8em; + } + } + } - .toggles .toggle { - @include toggle_button($toggle_radius: $radii * 2.4); - } + .toggles .toggle { + @include toggle_button($toggle_radius: $radii * 2.4); + } - .media { - @include media($height: 12em); - } + .media { + @include media($height: 12em); + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/screenshot.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/screenshot.scss index b67d501d..0afd0e1a 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/screenshot.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/screenshot.scss @@ -1,99 +1,99 @@ .background.takeshot { - background-color: rgba(0, 0, 0, 0.5); - - .content { - @include floating_widget; - - .takeshot-menu { - border-radius: $radii * 3; - padding: 15px; - } - - .button-bin { - margin: 15px; - margin-bottom: 0; - margin-top: 0; - - .button { - @include button($focusable: true); - border-radius: $radii * 2.4; - min-width: 130px; - min-height: 130px; - } - - .label { - font-size: 20px; - margin: 8px 0; - } - } - - .icon { - font-size: 5rem; - } - - .blue { - color: $blue; - } - - .red { - color: $red; - } - - .green { - color: $green; - } - } + background-color: rgba(0, 0, 0, 0.5); + + .content { + @include floating_widget; + + .takeshot-menu { + border-radius: $radii * 3; + padding: 15px; + } + + .button-bin { + margin: 15px; + margin-bottom: 0; + margin-top: 0; + + .button { + @include button($focusable: true); + border-radius: $radii * 2.4; + min-width: 130px; + min-height: 130px; + } + + .label { + font-size: 20px; + margin: 8px 0; + } + } + + .icon { + font-size: 5rem; + } + + .blue { + color: $blue; + } + + .red { + color: $red; + } + + .green { + color: $green; + } + } } .background.previewshot { - .content { - @include floating_widget; - - .previewshot-menu { - border-radius: $radii * 3; - padding: 15px; - } - - .button-bin { - margin: 15px; - margin-bottom: 0; - margin-top: 0; - - .button { - @include button($focusable: true); - border-radius: $radii; - min-width: 15px; - min-height: 50px; - } - - .label { - font-size: 15px; - margin: 8px 0; - } - } - - .icon { - font-size: 1.5rem; - } - - .blue { - color: $blue; - } - - .red { - color: $red; - } - - .green { - color: $green; - } - } - - .preview { - background-image: url("/tmp/screenshot.png"); - background-size: contain; - background-repeat: no-repeat; - background-position: center; - margin: 1rem; - } + .content { + @include floating_widget; + + .previewshot-menu { + border-radius: $radii * 3; + padding: 15px; + } + + .button-bin { + margin: 15px; + margin-bottom: 0; + margin-top: 0; + + .button { + @include button($focusable: true); + border-radius: $radii; + min-width: 15px; + min-height: 50px; + } + + .label { + font-size: 15px; + margin: 8px 0; + } + } + + .icon { + font-size: 1.5rem; + } + + .blue { + color: $blue; + } + + .red { + color: $red; + } + + .green { + color: $green; + } + } + + .preview { + background-image: url("/tmp/screenshot.png"); + background-size: contain; + background-repeat: no-repeat; + background-position: center; + margin: 1rem; + } } diff --git a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/vbar.scss b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/vbar.scss index f3c57230..83b3a714 100644 --- a/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/vbar.scss +++ b/home/isabel/programs/configs/gui/bars/eww/config/scss/windows/vbar.scss @@ -1,83 +1,83 @@ .vpanel { - min-width: 2.2em; - font-weight: bold; - color: $fg_color; - background-color: $bg_color; + min-width: 2.2em; + font-weight: bold; + color: $fg_color; + background-color: $bg_color; - // &.floating { - margin: $wm_gaps; - border-radius: $panel_radius; - box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); - border: $border_width solid $popover_border_color; - // } + // &.floating { + margin: $wm_gaps; + border-radius: $panel_radius; + box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); + border: $border_width solid $popover_border_color; + // } - .leftBar .button-bin { - margin: 0.4em 0.4em 0 0.4em; - } - .centerBar .button-bin { - margin: 0.2em 0.4em; - } - .rightBar .button-bin { - margin: 0 0.4em 0.4em 0.4em; - } + .leftBar .button-bin { + margin: 0.4em 0.4em 0 0.4em; + } + .centerBar .button-bin { + margin: 0.2em 0.4em; + } + .rightBar .button-bin { + margin: 0 0.4em 0.4em 0.4em; + } - .media { - @include panel_media(); - .player { - min-height: 2.6em; - } - } + .media { + @include panel_media(); + .player { + min-height: 2.6em; + } + } - .icon { - font-size: 1.3em; - } - .button { - @include button($flat: true, $radii: $panel_button_radius); - > * { - padding: 0.4em; - } + .icon { + font-size: 1.3em; + } + .button { + @include button($flat: true, $radii: $panel_button_radius); + > * { + padding: 0.4em; + } - &.launcher { - color: $blue; - } - &.powermenu { - color: $red; - } + &.launcher { + color: $blue; + } + &.powermenu { + color: $red; + } - &.clock { - @include button($flat: false, $interactive: true); - label { - font-size: 1.4em; - } - .separator { - min-height: 0.2em; - padding: 0 0.3em; - .dot { - min-height: 0.15em; - min-width: 0.15em; - border-radius: $radii; - background-color: $fg_color; - } - } - } + &.clock { + @include button($flat: false, $interactive: true); + label { + font-size: 1.4em; + } + .separator { + min-height: 0.2em; + padding: 0 0.3em; + .dot { + min-height: 0.15em; + min-width: 0.15em; + border-radius: $radii; + background-color: $fg_color; + } + } + } - &.workspaces { - @include workspaces; - } + &.workspaces { + @include workspaces; + } - &.system-indicators { - @include system-indicators($orientation: "v"); - } - } + &.system-indicators { + @include system-indicators($orientation: "v"); + } + } - > * > .separator { - margin: 0.3em 0; - padding: 0 0.8em; - .dot { - min-height: 0.3em; - min-width: 0.3em; - border-radius: $radii; - background-color: transparentize($fg_color, 0.6); - } - } + > * > .separator { + margin: 0.3em 0; + padding: 0 0.8em; + .dot { + min-height: 0.3em; + min-width: 0.3em; + border-radius: $radii; + background-color: transparentize($fg_color, 0.6); + } + } } diff --git a/modules/base/common/services/monitoring/grafana/dashboards/uptime-02.json b/modules/base/common/services/monitoring/grafana/dashboards/uptime-02.json index b6e81d38..7ea52bbf 100644 --- a/modules/base/common/services/monitoring/grafana/dashboards/uptime-02.json +++ b/modules/base/common/services/monitoring/grafana/dashboards/uptime-02.json @@ -1,282 +1,282 @@ { - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "type": "dashboard" - } - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": 1, - "links": [], - "liveNow": false, - "panels": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisBorderShow": false, - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 4, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } - }, - "mappings": [ - { - "options": { - "from": 0.9, - "result": { - "color": "green", - "index": 0, - "text": "Active" - }, - "to": 1 - }, - "type": "range" - }, - { - "options": { - "from": 0.3, - "result": { - "color": "yellow", - "index": 1, - "text": "Intermitant" - }, - "to": 0.9 - }, - "type": "range" - }, - { - "options": { - "from": 0, - "result": { - "color": "red", - "index": 2, - "text": "Failing" - }, - "to": 0.3 - }, - "type": "range" - } - ], - "max": 1, - "min": 0, - "thresholds": { - "mode": "percentage", - "steps": [ - { - "color": "red", - "value": null - }, - { - "color": "green", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 12, - "w": 14, - "x": 0, - "y": 0 - }, - "id": 1, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"docker-isabelroses-com.service\", state=\"active\"}", - "fullMetaSearch": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Isabelroses.com", - "range": true, - "refId": "Isabelroses.com", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"forgejo.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "forgejo", - "range": true, - "refId": "forgejo", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"opendkim.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Mailserver", - "range": true, - "refId": "Mailserver", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"phpfpm-roundcube.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Webmail", - "range": true, - "refId": "Webmail", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"matrix-synapse.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Matrix", - "range": true, - "refId": "Matrix", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"vaultwarden.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Vaultwarden", - "range": true, - "refId": "Vaultwarden", - "useBackend": false - }, - { - "datasource": { - "type": "prometheus", - "uid": "PBFA97CFB590B2093" - }, - "disableTextWrap": false, - "editorMode": "builder", - "expr": "node_systemd_unit_state{name=\"phpfpm-nextcloud.service\", state=\"active\"}", - "fullMetaSearch": false, - "hide": false, - "includeNullMetadata": true, - "instant": false, - "legendFormat": "Nextcloud", - "range": true, - "refId": "Nextcloud", - "useBackend": false - } - ], - "title": "Uptime", - "type": "timeseries" - } - ], - "refresh": "", - "schemaVersion": 38, - "tags": [], - "templating": { - "list": [] - }, - "time": { - "from": "now-6h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Uptime", - "uid": "b71552d2-05a6-45f6-8cc2-668da897b591", - "version": 3, - "weekStart": "" + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 4, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [ + { + "options": { + "from": 0.9, + "result": { + "color": "green", + "index": 0, + "text": "Active" + }, + "to": 1 + }, + "type": "range" + }, + { + "options": { + "from": 0.3, + "result": { + "color": "yellow", + "index": 1, + "text": "Intermitant" + }, + "to": 0.9 + }, + "type": "range" + }, + { + "options": { + "from": 0, + "result": { + "color": "red", + "index": 2, + "text": "Failing" + }, + "to": 0.3 + }, + "type": "range" + } + ], + "max": 1, + "min": 0, + "thresholds": { + "mode": "percentage", + "steps": [ + { + "color": "red", + "value": null + }, + { + "color": "green", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 12, + "w": 14, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"docker-isabelroses-com.service\", state=\"active\"}", + "fullMetaSearch": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Isabelroses.com", + "range": true, + "refId": "Isabelroses.com", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"forgejo.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "forgejo", + "range": true, + "refId": "forgejo", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"opendkim.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Mailserver", + "range": true, + "refId": "Mailserver", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"phpfpm-roundcube.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Webmail", + "range": true, + "refId": "Webmail", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"matrix-synapse.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Matrix", + "range": true, + "refId": "Matrix", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"vaultwarden.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Vaultwarden", + "range": true, + "refId": "Vaultwarden", + "useBackend": false + }, + { + "datasource": { + "type": "prometheus", + "uid": "PBFA97CFB590B2093" + }, + "disableTextWrap": false, + "editorMode": "builder", + "expr": "node_systemd_unit_state{name=\"phpfpm-nextcloud.service\", state=\"active\"}", + "fullMetaSearch": false, + "hide": false, + "includeNullMetadata": true, + "instant": false, + "legendFormat": "Nextcloud", + "range": true, + "refId": "Nextcloud", + "useBackend": false + } + ], + "title": "Uptime", + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 38, + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Uptime", + "uid": "b71552d2-05a6-45f6-8cc2-668da897b591", + "version": 3, + "weekStart": "" }