From 5fbf61834a62ccf93ca44837cdad11109f7e3024 Mon Sep 17 00:00:00 2001 From: SirBlobby Date: Sun, 19 Apr 2026 21:28:21 -0400 Subject: [PATCH] Added AGS --- .gitignore | 6 +++ ags/app.ts | 10 ++++ ags/config.js | 45 ++++++++++++++++++ ags/env.d.ts | 21 +++++++++ ags/package.json | 10 ++++ ags/style.css | 32 +++++++++++++ ags/tsconfig.json | 14 ++++++ ags/widget/Media.tsx | 49 ++++++++++++++++++++ install.sh | 19 ++++++-- waybar/config.jsonc | 106 ++++++++++++++++++++++++++++++------------- 10 files changed, 278 insertions(+), 34 deletions(-) create mode 100644 .gitignore create mode 100644 ags/app.ts create mode 100644 ags/config.js create mode 100644 ags/env.d.ts create mode 100644 ags/package.json create mode 100644 ags/style.css create mode 100644 ags/tsconfig.json create mode 100644 ags/widget/Media.tsx diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f064eee --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ + +node_modules +.env + + +ags/@girs/ \ No newline at end of file diff --git a/ags/app.ts b/ags/app.ts new file mode 100644 index 0000000..9f2a7cd --- /dev/null +++ b/ags/app.ts @@ -0,0 +1,10 @@ +import app from "ags/gtk3/app" +import style from "./style.css" +import Media from "./widget/Media" + +app.start({ + css: style, + main() { + app.get_monitors().map(Media) + }, +}) \ No newline at end of file diff --git a/ags/config.js b/ags/config.js new file mode 100644 index 0000000..18d6f80 --- /dev/null +++ b/ags/config.js @@ -0,0 +1,45 @@ +const mpris = await Service.import('mpris'); + +const Media = () => Widget.Box({ + class_name: 'media-container', + spacing: 10, + children: [ + Widget.Button({ + class_name: 'media-btn', + on_clicked: () => mpris.players[0]?.previous(), + child: Widget.Label('⏮'), + }), + Widget.Button({ + class_name: 'media-btn', + on_clicked: () => mpris.players[0]?.playPause(), + child: Widget.Label().hook(mpris, label => { + const player = mpris.players[0]; + label.label = player?.play_back_status === 'Playing' ? '⏸' : '▶'; + }), + }), + Widget.Button({ + class_name: 'media-btn', + on_clicked: () => mpris.players[0]?.next(), + child: Widget.Label('⏭'), + }), + Widget.Label({ + class_name: 'media-text', + }).hook(mpris, label => { + const player = mpris.players[0]; + label.label = player ? `${player.track_title} - ${player.track_artists.join(', ')}` : 'No Media Playing'; + }), + ], +}); + +App.config({ + style: './style.css', + windows: [ + Widget.Window({ + name: 'media_widget', + anchor: ['bottom', 'left'], + margins: [0, 0, 20, 20], + layer: 'bottom', + child: Media(), + }) + ] +}); \ No newline at end of file diff --git a/ags/env.d.ts b/ags/env.d.ts new file mode 100644 index 0000000..792ebfd --- /dev/null +++ b/ags/env.d.ts @@ -0,0 +1,21 @@ +declare const SRC: string + +declare module "inline:*" { + const content: string + export default content +} + +declare module "*.scss" { + const content: string + export default content +} + +declare module "*.blp" { + const content: string + export default content +} + +declare module "*.css" { + const content: string + export default content +} diff --git a/ags/package.json b/ags/package.json new file mode 100644 index 0000000..cbf736c --- /dev/null +++ b/ags/package.json @@ -0,0 +1,10 @@ +{ + "dependencies": { + "ags": "*", + "gnim": "*" + }, + "prettier": { + "semi": false, + "tabWidth": 2 + } +} diff --git a/ags/style.css b/ags/style.css new file mode 100644 index 0000000..a5e1356 --- /dev/null +++ b/ags/style.css @@ -0,0 +1,32 @@ +* { + all: unset; +} + +.MediaWindow { + background-color: transparent; +} + +.media-container { + background-color: rgba(30, 30, 46, 0.85); + border-radius: 8px; + border: 2px solid rgba(137, 180, 250, 0.5); + padding: 8px 15px; + font-family: "JetBrainsMono Nerd Font", sans-serif; +} + +.media-btn { + color: #cba6f7; + font-size: 16px; + padding: 0 5px; + transition: all 0.2s; +} + +.media-btn:hover { + color: #89b4fa; +} + +.media-text { + color: #cdd6f4; + font-size: 14px; + margin-left: 10px; +} \ No newline at end of file diff --git a/ags/tsconfig.json b/ags/tsconfig.json new file mode 100644 index 0000000..d20cbbc --- /dev/null +++ b/ags/tsconfig.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "compilerOptions": { + "strict": true, + "module": "ES2022", + "target": "ES2020", + "lib": ["ES2023"], + "moduleResolution": "Bundler", + // "checkJs": true, + // "allowJs": true, + "jsx": "react-jsx", + "jsxImportSource": "ags/gtk3" + } +} diff --git a/ags/widget/Media.tsx b/ags/widget/Media.tsx new file mode 100644 index 0000000..a7fcb53 --- /dev/null +++ b/ags/widget/Media.tsx @@ -0,0 +1,49 @@ +import app from "ags/gtk3/app" +import { Astal, Gtk, Gdk } from "ags/gtk3" +import { execAsync } from "ags/process" +import { createPoll } from "ags/time" + +export default function Media(gdkmonitor: Gdk.Monitor) { + const { TOP, LEFT } = Astal.WindowAnchor + + // Poll playerctl for metadata and status + const mediaInfo = createPoll("No Media Playing", 1000, 'sh -c "playerctl metadata -f \'{{title}} - {{artist}}\' 2>/dev/null || echo \'No Media Playing\'"') + const statusIcon = createPoll("▶", 1000, 'sh -c "s=\\$(playerctl status 2>/dev/null); if [ \\"\\$s\\" = \\"Playing\\" ]; then echo \\"⏸\\"; else echo \\"▶\\"; fi"') + + return ( + + + + + + + + ) +} \ No newline at end of file diff --git a/install.sh b/install.sh index a99ab71..d7b77be 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,6 @@ set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -TIMESTAMP=$(date +%Y%m%d_%H%M%S) HOME_DIR="$(eval echo ~$(whoami))" FORCE=false CHECK=false @@ -85,8 +84,9 @@ backup_and_copy() { if [ "$FORCE" = true ]; then echo "[BACKUP] $name: Backing up..." - mkdir -p "$dest.bak.$TIMESTAMP" - cp -r "$dest"/* "$dest.bak.$TIMESTAMP/" 2>/dev/null || true + rm -rf "$dest.bak" + mkdir -p "$dest.bak" + cp -r "$dest"/* "$dest.bak/" 2>/dev/null || true echo "[COPY] $name: Overwriting (--force)" cp -r "$src"/* "$dest"/ @@ -101,6 +101,9 @@ echo "" check_status=0 check_file "$SCRIPT_DIR/waybar/config.jsonc" "$HOME_DIR/.config/waybar/config.jsonc" "waybar/config.jsonc" || check_status=1 +check_file "$SCRIPT_DIR/ags/app.ts" "$HOME_DIR/.config/ags/app.ts" "ags/app.ts" || check_status=1 +check_file "$SCRIPT_DIR/ags/style.css" "$HOME_DIR/.config/ags/style.css" "ags/style.css" || check_status=1 +check_file "$SCRIPT_DIR/ags/widget/Media.tsx" "$HOME_DIR/.config/ags/widget/Media.tsx" "ags/widget/Media.tsx" || check_status=1 check_file "$SCRIPT_DIR/waybar/style.css" "$HOME_DIR/.config/waybar/style.css" "waybar/style.css" || check_status=1 check_file "$SCRIPT_DIR/branding/about.txt" "$HOME_DIR/.config/omarchy/branding/about.txt" "branding/about.txt" || check_status=1 check_file "$SCRIPT_DIR/branding/screensaver.txt" "$HOME_DIR/.config/omarchy/branding/screensaver.txt" "branding/screensaver.txt" || check_status=1 @@ -133,6 +136,7 @@ echo "=== Applying changes ===" echo "" backup_and_copy "$SCRIPT_DIR/waybar" "$HOME_DIR/.config/waybar" "Waybar config" +backup_and_copy "$SCRIPT_DIR/ags" "$HOME_DIR/.config/ags" "AGS config" backup_and_copy "$SCRIPT_DIR/branding" "$HOME_DIR/.config/omarchy/branding" "Branding files" mkdir -p "$HOME_DIR/scripts" @@ -211,6 +215,15 @@ else echo "Warning: omarchy-restart-waybar not found. Please restart waybar manually." fi +echo "" +echo "=== Restarting AGS ===" +if command -v ags &> /dev/null; then + ags quit || true + nohup ags run -d "$HOME_DIR/.config/ags" >/dev/null 2>&1 & +else + echo "Warning: ags not found. Please start ags manually." +fi + echo "" echo "=== Installation Complete ===" echo "Scripts are in: $HOME_DIR/scripts/" diff --git a/waybar/config.jsonc b/waybar/config.jsonc index c7c9c9d..f26cb25 100644 --- a/waybar/config.jsonc +++ b/waybar/config.jsonc @@ -4,8 +4,18 @@ "position": "top", "spacing": 0, "height": 30, - "modules-left": ["custom/omarchy", "hyprland/workspaces"], - "modules-center": ["clock", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], + "modules-left": [ + "custom/omarchy", + "hyprland/workspaces" + ], + "modules-center": [ + "clock", + "custom/update", + "custom/voxtype", + "custom/screenrecording-indicator", + "custom/idle-indicator", + "custom/notification-silencing-indicator" + ], "modules-right": [ "group/tray-expander", "bluetooth", @@ -18,12 +28,12 @@ ], "memory": { "interval": 10, - "format": "󰘚", + "format": "\udb81\ude1a", "tooltip-format": "Memory: {used:0.1f}G/{total:0.1f}G" }, "disk": { "interval": 30, - "format": "󰋊", + "format": "\udb80\udeca", "path": "/", "tooltip-format": "Disk: {used}/{total}" }, @@ -31,7 +41,7 @@ "on-click": "activate", "format": "{icon}", "format-icons": { - "default": "", + "default": "\uea71", "1": "1", "2": "2", "3": "3", @@ -42,7 +52,7 @@ "8": "8", "9": "9", "10": "0", - "active": "󱓻" + "active": "\udb85\udcfb" }, "persistent-workspaces": { "1": [], @@ -63,17 +73,16 @@ "tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space" }, "custom/update": { - "format": "", + "format": "\uf021", "exec": "omarchy-update-available", "on-click": "omarchy-launch-floating-terminal-with-presentation omarchy-update", "tooltip-format": "Omarchy update available", "signal": 7, "interval": 21600 }, - "cpu": { "interval": 5, - "format": "󰍛", + "format": "\udb80\udf5b", "on-click": "omarchy-launch-or-focus-tui btop", "on-click-right": "alacritty" }, @@ -84,11 +93,17 @@ "on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select" }, "network": { - "format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], + "format-icons": [ + "\udb82\udd2f", + "\udb82\udd1f", + "\udb82\udd22", + "\udb82\udd25", + "\udb82\udd28" + ], "format": "{icon}", "format-wifi": "{icon}", - "format-ethernet": "󰀂", - "format-disconnected": "󰤮", + "format-ethernet": "\udb80\udc02", + "format-disconnected": "\udb82\udd2e", "tooltip-format-wifi": "{essid} ({frequency} GHz)", "tooltip-format-ethernet": "Connected", "tooltip-format-disconnected": "Disconnected", @@ -100,14 +115,36 @@ "format": "{capacity}% {icon}", "format-discharging": "{icon}", "format-charging": "{icon}", - "format-plugged": "", + "format-plugged": "\uf1e6", "format-icons": { - "charging": ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], - "default": ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] + "charging": [ + "\udb82\udc9c", + "\udb80\udc86", + "\udb80\udc87", + "\udb80\udc88", + "\udb82\udc9d", + "\udb80\udc89", + "\udb82\udc9e", + "\udb80\udc8a", + "\udb80\udc8b", + "\udb80\udc85" + ], + "default": [ + "\udb80\udc7a", + "\udb80\udc7b", + "\udb80\udc7c", + "\udb80\udc7d", + "\udb80\udc7e", + "\udb80\udc7f", + "\udb80\udc80", + "\udb80\udc81", + "\udb80\udc82", + "\udb80\udc79" + ] }, - "format-full": "󰂅", - "tooltip-format-discharging": "{power:>1.0f}W↓ {capacity}%", - "tooltip-format-charging": "{power:>1.0f}W↑ {capacity}%", + "format-full": "\udb80\udc85", + "tooltip-format-discharging": "{power:>1.0f}W\u2193 {capacity}%", + "tooltip-format-charging": "{power:>1.0f}W\u2191 {capacity}%", "interval": 5, "on-click": "omarchy-menu power", "states": { @@ -116,10 +153,10 @@ } }, "bluetooth": { - "format": "", - "format-off": "󰂲", - "format-disabled": "󰂲", - "format-connected": "󰂱", + "format": "\uf294", + "format-off": "\udb80\udcb2", + "format-disabled": "\udb80\udcb2", + "format-connected": "\udb80\udcb1", "format-no-controller": "", "tooltip-format": "Devices connected: {num_connections}", "on-click": "omarchy-launch-bluetooth" @@ -130,11 +167,15 @@ "on-click-right": "pamixer -t", "tooltip-format": "Playing at {volume}%", "scroll-step": 5, - "format-muted": "", + "format-muted": "\ueee8", "format-icons": { - "headphone": "", - "headset": "", - "default": ["", "", ""] + "headphone": "\uf025", + "headset": "\uf025", + "default": [ + "\uf026", + "\uf027", + "\uf028" + ] } }, "group/tray-expander": { @@ -143,10 +184,13 @@ "transition-duration": 600, "children-class": "tray-group-item" }, - "modules": ["custom/expand-icon", "tray"] + "modules": [ + "custom/expand-icon", + "tray" + ] }, "custom/expand-icon": { - "format": "", + "format": "\uf053", "tooltip": false, "on-scroll-up": "", "on-scroll-down": "", @@ -165,8 +209,8 @@ "format": "{icon}", "format-icons": { "idle": "", - "recording": "󰍬", - "transcribing": "󰔟" + "recording": "\udb80\udf6c", + "transcribing": "\udb81\udd1f" }, "tooltip": true, "on-click-right": "omarchy-voxtype-config", @@ -188,4 +232,4 @@ "icon-size": 14, "spacing": 17 } -} +} \ No newline at end of file