initial commit
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
@girs/
|
||||||
10
app.ts
Normal file
10
app.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import app from "ags/gtk4/app"
|
||||||
|
import style from "./style.scss"
|
||||||
|
import Bar from "./widget/Bar"
|
||||||
|
|
||||||
|
app.start({
|
||||||
|
css: style,
|
||||||
|
main() {
|
||||||
|
app.get_monitors().map(Bar)
|
||||||
|
},
|
||||||
|
})
|
||||||
21
env.d.ts
vendored
Normal file
21
env.d.ts
vendored
Normal 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
package.json
Normal file
10
package.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"ags": "*",
|
||||||
|
"gnim": "*"
|
||||||
|
},
|
||||||
|
"prettier": {
|
||||||
|
"semi": false,
|
||||||
|
"tabWidth": 2
|
||||||
|
}
|
||||||
|
}
|
||||||
20
style.scss
Normal file
20
style.scss
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/theme/Adwaita/_colors-public.scss
|
||||||
|
$fg-color: #{"@theme_fg_color"};
|
||||||
|
$bg-color: #{"@theme_bg_color"};
|
||||||
|
|
||||||
|
window.Bar {
|
||||||
|
background: transparent;
|
||||||
|
color: $fg-color;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
> centerbox {
|
||||||
|
background: $bg-color;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
tsconfig.json
Normal file
14
tsconfig.json
Normal 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/gtk4"
|
||||||
|
}
|
||||||
|
}
|
||||||
39
widget/Bar.tsx
Normal file
39
widget/Bar.tsx
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import app from "ags/gtk4/app"
|
||||||
|
import { Astal, Gtk, Gdk } from "ags/gtk4"
|
||||||
|
import { execAsync } from "ags/process"
|
||||||
|
import { createPoll } from "ags/time"
|
||||||
|
|
||||||
|
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
|
const time = createPoll("", 1000, "date")
|
||||||
|
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
||||||
|
|
||||||
|
return (
|
||||||
|
<window
|
||||||
|
visible
|
||||||
|
name="bar"
|
||||||
|
class="Bar"
|
||||||
|
gdkmonitor={gdkmonitor}
|
||||||
|
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
||||||
|
anchor={TOP | LEFT | RIGHT}
|
||||||
|
application={app}
|
||||||
|
>
|
||||||
|
<centerbox cssName="centerbox">
|
||||||
|
<button
|
||||||
|
$type="start"
|
||||||
|
onClicked={() => execAsync("echo hello").then(console.log)}
|
||||||
|
hexpand
|
||||||
|
halign={Gtk.Align.CENTER}
|
||||||
|
>
|
||||||
|
<label label="Welcome to AGS!" />
|
||||||
|
</button>
|
||||||
|
<box $type="center" />
|
||||||
|
<menubutton $type="end" hexpand halign={Gtk.Align.CENTER}>
|
||||||
|
<label label={time} />
|
||||||
|
<popover>
|
||||||
|
<Gtk.Calendar />
|
||||||
|
</popover>
|
||||||
|
</menubutton>
|
||||||
|
</centerbox>
|
||||||
|
</window>
|
||||||
|
)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user