diff --git a/package-lock.json b/package-lock.json index 805990a..36f38d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,12 @@ { - "name": "ags", + "name": "tacitshell", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { + "name": "tacitshell", + "version": "0.1.0", "dependencies": { "ags": "*", "gnim": "*", @@ -19,7 +22,7 @@ }, "../../../../usr/share/ags/js": { "name": "ags", - "version": "3.1.0", + "version": "3.1.2", "license": "LGPL-2.1", "os": [ "linux" @@ -38,7 +41,7 @@ "url": "https://ko-fi.com/aylur" }, "peerDependencies": { - "gnim": "^1.9.0" + "gnim": "^1.9.1" } }, "../../../../usr/share/ags/js/node_modules/gnim": { diff --git a/package.json b/package.json index 177d319..45a3879 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "qileshell", + "name": "tacitshell", "version": "0.1.0", "dependencies": { "ags": "*", diff --git a/style.scss b/style.scss index 01ed3d4..cd5e665 100644 --- a/style.scss +++ b/style.scss @@ -3,7 +3,6 @@ $fg-color: wal.$foreground; $bg-color: rgba(wal.$background, 0.8); -// Unified sizing variables $btn-height: 30px; $btn-radius: 8px; $btn-margin: 4px 2px; @@ -27,18 +26,12 @@ window.Bar { padding: 0 4px; } - // Base button styling for absolute uniformity button { border-radius: $btn-radius; margin: $btn-margin; min-height: $btn-height; transition: all 0.2s ease-in-out; - background: rgba( - 150, - 150, - 150, - 0.1 - ); // Slight base background for all buttons + background: rgba(150, 150, 150, 0.1); border: none; box-shadow: none; @@ -49,14 +42,14 @@ window.Bar { .workspaces { .workspace-btn { - min-width: $btn-height; // Base square size + min-width: $btn-height; padding: 0; - border-radius: 100px; // Pill shape instead of blocky squares + border-radius: 100px; background-color: transparent; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); &.active { - min-width: 45px; // Horizontal expansion, slightly less wide + min-width: 45px; background-color: wal.$color2; color: wal.$background; } @@ -108,12 +101,11 @@ window.Bar { } } - // Icon-only control buttons (wallpaper, settings, power, etc) .control-btn, .wallpaper-btn, .power-btn { min-width: $btn-height; - padding: 0; // Square buttons should have 0 padding, width handles size + padding: 0; image { -gtk-icon-size: $icon-size; } @@ -215,3 +207,53 @@ window.PowerMenu { transition: all 0.2s ease-in-out; } } + +.media-controls { + .media-ctrl-btn { + border-radius: 50%; + min-width: 40px; + min-height: 40px; + padding: 0; + background: rgba(wal.$foreground, 0.08); + border: 1px solid rgba(wal.$foreground, 0.1); + transition: all 0.2s ease-in-out; + + &:hover { + background: rgba(wal.$foreground, 0.18); + transform: scale(1.08); + } + + &:active { + transform: scale(0.95); + background: rgba(wal.$foreground, 0.25); + } + } + + .play-pause-btn { + min-width: 48px; + min-height: 48px; + background: wal.$color2; + color: wal.$background; + border: none; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); + + &:hover { + background: rgba(wal.$color2, 0.85); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); + } + + image { + color: wal.$background; + } + } + + .skip-btn { + background: transparent; + border: 1.5px solid rgba(wal.$foreground, 0.2); + + &:hover { + background: rgba(wal.$foreground, 0.1); + border-color: rgba(wal.$foreground, 0.35); + } + } +} diff --git a/widget/QuickSettings.tsx b/widget/QuickSettings.tsx index 514f278..79751f1 100644 --- a/widget/QuickSettings.tsx +++ b/widget/QuickSettings.tsx @@ -2,37 +2,75 @@ import { Gtk } from "ags/gtk4" import AstalNetwork from "gi://AstalNetwork?version=0.1" import AstalBluetooth from "gi://AstalBluetooth?version=0.1" import AstalWp from "gi://AstalWp?version=0.1" -import { createBinding } from "ags" -import { execAsync } from "ags/process" +import { createBinding, createComputed, createState, For } from "ags" +import { interval } from "ags/time" +import { exec, execAsync } from "ags/process" + +interface VpnConn { + name: string + active: boolean +} + +const VPN_TYPES = new Set(["vpn", "wireguard"]) + +function fetchVpns(): VpnConn[] { + try { + const stdout = exec([ + "nmcli", + "-t", + "-f", + "NAME,TYPE,DEVICE", + "connection", + "show", + ]) + return stdout + .trim() + .split("\n") + .map((line) => line.split(":")) + .filter(([, type]) => VPN_TYPES.has(type)) + .map(([name, , device]) => ({ name, active: !!device })) + } catch (e) { + console.error("nmcli query failed:", e) + return [] + } +} + +const [vpns, setVpns] = createState(fetchVpns()) + +interval(2000, () => setVpns(fetchVpns())) + +const vpnActive = vpns((list) => list.some((c) => c.active)) function NetworkItem() { const network = AstalNetwork.Network.get_default() + const primary = createBinding(network, "primary") + + const label = createComputed(() => { + const p = primary() + if (p === AstalNetwork.Primary.WIFI && network.wifi) { + return network.wifi.ssid || "Unknown Wi-Fi" + } else if (p === AstalNetwork.Primary.WIRED) { + return "Wired Connection" + } + return vpnActive() ? "Connected to VPN" : "Disconnected" + }) return ( { + iconName={primary.as((p) => { if (p === AstalNetwork.Primary.WIFI && network.wifi) { return network.wifi.icon_name } else if (p === AstalNetwork.Primary.WIRED && network.wired) { return network.wired.icon_name } - return "network-offline-symbolic" + return vpnActive() + ? "network-vpn-symbolic" + : "network-offline-symbolic" })} cssClasses={["qs-icon"]} /> - ) } @@ -97,6 +135,61 @@ function AudioSlider({ type }: { type: "speaker" | "microphone" }) { ) } +function VpnList() { + const isEmpty = vpns((list) => list.length === 0) + + function toggle(conn: VpnConn) { + const cmd = conn.active + ? ["nmcli", "connection", "down", conn.name] + : ["nmcli", "connection", "up", conn.name] + execAsync(cmd) + .then(() => setVpns(fetchVpns())) + .catch((e) => console.error("VPN toggle failed:", e)) + } + + return ( + + + ) +} + export default function QuickSettings() { return ( +