Added AGS
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
|
||||
node_modules
|
||||
.env
|
||||
|
||||
|
||||
ags/@girs/
|
||||
+10
@@ -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)
|
||||
},
|
||||
})
|
||||
@@ -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(),
|
||||
})
|
||||
]
|
||||
});
|
||||
Vendored
+21
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"ags": "*",
|
||||
"gnim": "*"
|
||||
},
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"tabWidth": 2
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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
@@ -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/"
|
||||
|
||||
+75
-31
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user