mirror of
https://github.com/tuxdotrs/tpanel.git
synced 2025-10-10 12:51:54 +05:30
feat(control-center): integrate actions with app toggle
This commit is contained in:
@@ -2,6 +2,8 @@ import { Gdk, Gtk } from "ags/gtk4";
|
|||||||
import { execAsync } from "ags/process";
|
import { execAsync } from "ags/process";
|
||||||
import { createPoll } from "ags/time";
|
import { createPoll } from "ags/time";
|
||||||
import GLib from "gi://GLib";
|
import GLib from "gi://GLib";
|
||||||
|
import { WINDOW_NAME } from ".";
|
||||||
|
import app from "ags/gtk4/app";
|
||||||
|
|
||||||
export const Header = () => {
|
export const Header = () => {
|
||||||
const { VERTICAL } = Gtk.Orientation;
|
const { VERTICAL } = Gtk.Orientation;
|
||||||
@@ -13,6 +15,11 @@ export const Header = () => {
|
|||||||
() => GLib.DateTime.new_now_local().format("%a %b %d - %I:%M:%S %p")!,
|
() => GLib.DateTime.new_now_local().format("%a %b %d - %I:%M:%S %p")!,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleExec = (cmd: string) => {
|
||||||
|
app.toggle_window(WINDOW_NAME);
|
||||||
|
execAsync(cmd);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<box cssClasses={["header"]}>
|
<box cssClasses={["header"]}>
|
||||||
<image
|
<image
|
||||||
@@ -37,21 +44,21 @@ export const Header = () => {
|
|||||||
<box spacing={10} homogeneous>
|
<box spacing={10} homogeneous>
|
||||||
<button
|
<button
|
||||||
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
onClicked={() => execAsync("flameshot launcher")}
|
onClicked={() => handleExec("flameshot launcher")}
|
||||||
>
|
>
|
||||||
<image iconName="fa-screenshot-symbolic" />
|
<image iconName="fa-screenshot-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
onClicked={() => execAsync("hyprlock")}
|
onClicked={() => handleExec("hyprlock")}
|
||||||
>
|
>
|
||||||
<image iconName="fa-lock-symbolic" />
|
<image iconName="fa-lock-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
cursor={Gdk.Cursor.new_from_name("pointer", null)}
|
||||||
onClicked={() => execAsync("poweroff")}
|
onClicked={() => handleExec("poweroff")}
|
||||||
>
|
>
|
||||||
<image iconName="fa-power-symbolic" />
|
<image iconName="fa-power-symbolic" />
|
||||||
</button>
|
</button>
|
||||||
|
@@ -15,7 +15,6 @@ export const ControlCenter = (gdkmonitor: Gdk.Monitor) => {
|
|||||||
return (
|
return (
|
||||||
<window
|
<window
|
||||||
name={WINDOW_NAME}
|
name={WINDOW_NAME}
|
||||||
visible
|
|
||||||
cssClasses={["control-center"]}
|
cssClasses={["control-center"]}
|
||||||
gdkmonitor={gdkmonitor}
|
gdkmonitor={gdkmonitor}
|
||||||
application={app}
|
application={app}
|
||||||
|
Reference in New Issue
Block a user