Added AGS

This commit is contained in:
2026-04-19 21:28:21 -04:00
parent 24dd3e0271
commit 5fbf61834a
10 changed files with 278 additions and 34 deletions
+6
View File
@@ -0,0 +1,6 @@
node_modules
.env
ags/@girs/
+10
View File
@@ -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)
},
})
+45
View File
@@ -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(),
})
]
});
+21
View File
@@ -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
}
+10
View File
@@ -0,0 +1,10 @@
{
"dependencies": {
"ags": "*",
"gnim": "*"
},
"prettier": {
"semi": false,
"tabWidth": 2
}
}
+32
View File
@@ -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;
}
+14
View File
@@ -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"
}
}
+49
View File
@@ -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 (
<window
class="MediaWindow"
gdkmonitor={gdkmonitor}
exclusivity={Astal.Exclusivity.NORMAL}
layer={Astal.Layer.BOTTOM}
anchor={TOP | LEFT}
margin={20}
application={app}
>
<box class="media-container" spacing={10}>
<button
class="media-btn"
onClicked={() => execAsync("playerctl previous").catch(print)}
halign={Gtk.Align.CENTER}
>
<label label="⏮" />
</button>
<button
class="media-btn"
onClicked={() => execAsync("playerctl play-pause").catch(print)}
halign={Gtk.Align.CENTER}
>
<label label={statusIcon} />
</button>
<button
class="media-btn"
onClicked={() => execAsync("playerctl next").catch(print)}
halign={Gtk.Align.CENTER}
>
<label label="⏭" />
</button>
<label class="media-text" label={mediaInfo} />
</box>
</window>
)
}
+16 -3
View File
@@ -3,7 +3,6 @@
set -e set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
HOME_DIR="$(eval echo ~$(whoami))" HOME_DIR="$(eval echo ~$(whoami))"
FORCE=false FORCE=false
CHECK=false CHECK=false
@@ -85,8 +84,9 @@ backup_and_copy() {
if [ "$FORCE" = true ]; then if [ "$FORCE" = true ]; then
echo "[BACKUP] $name: Backing up..." echo "[BACKUP] $name: Backing up..."
mkdir -p "$dest.bak.$TIMESTAMP" rm -rf "$dest.bak"
cp -r "$dest"/* "$dest.bak.$TIMESTAMP/" 2>/dev/null || true mkdir -p "$dest.bak"
cp -r "$dest"/* "$dest.bak/" 2>/dev/null || true
echo "[COPY] $name: Overwriting (--force)" echo "[COPY] $name: Overwriting (--force)"
cp -r "$src"/* "$dest"/ cp -r "$src"/* "$dest"/
@@ -101,6 +101,9 @@ echo ""
check_status=0 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/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/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/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 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 "" echo ""
backup_and_copy "$SCRIPT_DIR/waybar" "$HOME_DIR/.config/waybar" "Waybar config" 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" backup_and_copy "$SCRIPT_DIR/branding" "$HOME_DIR/.config/omarchy/branding" "Branding files"
mkdir -p "$HOME_DIR/scripts" mkdir -p "$HOME_DIR/scripts"
@@ -211,6 +215,15 @@ else
echo "Warning: omarchy-restart-waybar not found. Please restart waybar manually." echo "Warning: omarchy-restart-waybar not found. Please restart waybar manually."
fi 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 ""
echo "=== Installation Complete ===" echo "=== Installation Complete ==="
echo "Scripts are in: $HOME_DIR/scripts/" echo "Scripts are in: $HOME_DIR/scripts/"
+75 -31
View File
@@ -4,8 +4,18 @@
"position": "top", "position": "top",
"spacing": 0, "spacing": 0,
"height": 30, "height": 30,
"modules-left": ["custom/omarchy", "hyprland/workspaces"], "modules-left": [
"modules-center": ["clock", "custom/update", "custom/voxtype", "custom/screenrecording-indicator", "custom/idle-indicator", "custom/notification-silencing-indicator"], "custom/omarchy",
"hyprland/workspaces"
],
"modules-center": [
"clock",
"custom/update",
"custom/voxtype",
"custom/screenrecording-indicator",
"custom/idle-indicator",
"custom/notification-silencing-indicator"
],
"modules-right": [ "modules-right": [
"group/tray-expander", "group/tray-expander",
"bluetooth", "bluetooth",
@@ -18,12 +28,12 @@
], ],
"memory": { "memory": {
"interval": 10, "interval": 10,
"format": "󰘚", "format": "\udb81\ude1a",
"tooltip-format": "Memory: {used:0.1f}G/{total:0.1f}G" "tooltip-format": "Memory: {used:0.1f}G/{total:0.1f}G"
}, },
"disk": { "disk": {
"interval": 30, "interval": 30,
"format": "󰋊", "format": "\udb80\udeca",
"path": "/", "path": "/",
"tooltip-format": "Disk: {used}/{total}" "tooltip-format": "Disk: {used}/{total}"
}, },
@@ -31,7 +41,7 @@
"on-click": "activate", "on-click": "activate",
"format": "{icon}", "format": "{icon}",
"format-icons": { "format-icons": {
"default": "", "default": "\uea71",
"1": "1", "1": "1",
"2": "2", "2": "2",
"3": "3", "3": "3",
@@ -42,7 +52,7 @@
"8": "8", "8": "8",
"9": "9", "9": "9",
"10": "0", "10": "0",
"active": "󱓻" "active": "\udb85\udcfb"
}, },
"persistent-workspaces": { "persistent-workspaces": {
"1": [], "1": [],
@@ -63,17 +73,16 @@
"tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space" "tooltip-format": "Omarchy Menu\n\nSuper + Alt + Space"
}, },
"custom/update": { "custom/update": {
"format": "", "format": "\uf021",
"exec": "omarchy-update-available", "exec": "omarchy-update-available",
"on-click": "omarchy-launch-floating-terminal-with-presentation omarchy-update", "on-click": "omarchy-launch-floating-terminal-with-presentation omarchy-update",
"tooltip-format": "Omarchy update available", "tooltip-format": "Omarchy update available",
"signal": 7, "signal": 7,
"interval": 21600 "interval": 21600
}, },
"cpu": { "cpu": {
"interval": 5, "interval": 5,
"format": "󰍛", "format": "\udb80\udf5b",
"on-click": "omarchy-launch-or-focus-tui btop", "on-click": "omarchy-launch-or-focus-tui btop",
"on-click-right": "alacritty" "on-click-right": "alacritty"
}, },
@@ -84,11 +93,17 @@
"on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select" "on-click-right": "omarchy-launch-floating-terminal-with-presentation omarchy-tz-select"
}, },
"network": { "network": {
"format-icons": ["󰤯", "󰤟", "󰤢", "󰤥", "󰤨"], "format-icons": [
"\udb82\udd2f",
"\udb82\udd1f",
"\udb82\udd22",
"\udb82\udd25",
"\udb82\udd28"
],
"format": "{icon}", "format": "{icon}",
"format-wifi": "{icon}", "format-wifi": "{icon}",
"format-ethernet": "󰀂", "format-ethernet": "\udb80\udc02",
"format-disconnected": "󰤮", "format-disconnected": "\udb82\udd2e",
"tooltip-format-wifi": "{essid} ({frequency} GHz)", "tooltip-format-wifi": "{essid} ({frequency} GHz)",
"tooltip-format-ethernet": "Connected", "tooltip-format-ethernet": "Connected",
"tooltip-format-disconnected": "Disconnected", "tooltip-format-disconnected": "Disconnected",
@@ -100,14 +115,36 @@
"format": "{capacity}% {icon}", "format": "{capacity}% {icon}",
"format-discharging": "{icon}", "format-discharging": "{icon}",
"format-charging": "{icon}", "format-charging": "{icon}",
"format-plugged": "", "format-plugged": "\uf1e6",
"format-icons": { "format-icons": {
"charging": ["󰢜", "󰂆", "󰂇", "󰂈", "󰢝", "󰂉", "󰢞", "󰂊", "󰂋", "󰂅"], "charging": [
"default": ["󰁺", "󰁻", "󰁼", "󰁽", "󰁾", "󰁿", "󰂀", "󰂁", "󰂂", "󰁹"] "\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": "󰂅", "format-full": "\udb80\udc85",
"tooltip-format-discharging": "{power:>1.0f}W {capacity}%", "tooltip-format-discharging": "{power:>1.0f}W\u2193 {capacity}%",
"tooltip-format-charging": "{power:>1.0f}W {capacity}%", "tooltip-format-charging": "{power:>1.0f}W\u2191 {capacity}%",
"interval": 5, "interval": 5,
"on-click": "omarchy-menu power", "on-click": "omarchy-menu power",
"states": { "states": {
@@ -116,10 +153,10 @@
} }
}, },
"bluetooth": { "bluetooth": {
"format": "", "format": "\uf294",
"format-off": "󰂲", "format-off": "\udb80\udcb2",
"format-disabled": "󰂲", "format-disabled": "\udb80\udcb2",
"format-connected": "󰂱", "format-connected": "\udb80\udcb1",
"format-no-controller": "", "format-no-controller": "",
"tooltip-format": "Devices connected: {num_connections}", "tooltip-format": "Devices connected: {num_connections}",
"on-click": "omarchy-launch-bluetooth" "on-click": "omarchy-launch-bluetooth"
@@ -130,11 +167,15 @@
"on-click-right": "pamixer -t", "on-click-right": "pamixer -t",
"tooltip-format": "Playing at {volume}%", "tooltip-format": "Playing at {volume}%",
"scroll-step": 5, "scroll-step": 5,
"format-muted": "", "format-muted": "\ueee8",
"format-icons": { "format-icons": {
"headphone": "", "headphone": "\uf025",
"headset": "", "headset": "\uf025",
"default": ["", "", ""] "default": [
"\uf026",
"\uf027",
"\uf028"
]
} }
}, },
"group/tray-expander": { "group/tray-expander": {
@@ -143,10 +184,13 @@
"transition-duration": 600, "transition-duration": 600,
"children-class": "tray-group-item" "children-class": "tray-group-item"
}, },
"modules": ["custom/expand-icon", "tray"] "modules": [
"custom/expand-icon",
"tray"
]
}, },
"custom/expand-icon": { "custom/expand-icon": {
"format": "", "format": "\uf053",
"tooltip": false, "tooltip": false,
"on-scroll-up": "", "on-scroll-up": "",
"on-scroll-down": "", "on-scroll-down": "",
@@ -165,8 +209,8 @@
"format": "{icon}", "format": "{icon}",
"format-icons": { "format-icons": {
"idle": "", "idle": "",
"recording": "󰍬", "recording": "\udb80\udf6c",
"transcribing": "󰔟" "transcribing": "\udb81\udd1f"
}, },
"tooltip": true, "tooltip": true,
"on-click-right": "omarchy-voxtype-config", "on-click-right": "omarchy-voxtype-config",
@@ -188,4 +232,4 @@
"icon-size": 14, "icon-size": 14,
"spacing": 17 "spacing": 17
} }
} }