Restructure
This commit is contained in:
parent
1f9feeb85f
commit
3060c2b06e
@ -21,7 +21,7 @@ alias open-webui='sudo systemctl start docker && sudo docker start -i open-webui
|
|||||||
alias ai='ollama serve'
|
alias ai='ollama serve'
|
||||||
|
|
||||||
# Add scripts in ~/projects/active/dotfiles/general/scripts/ to path
|
# Add scripts in ~/projects/active/dotfiles/general/scripts/ to path
|
||||||
fish_add_path -P ~/projects/active/dotfiles/general/scripts/
|
fish_add_path -P ~/projects/active/dotfiles/scripts/
|
||||||
|
|
||||||
function y
|
function y
|
||||||
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
set tmp (mktemp -t "yazi-cwd.XXXXXX")
|
2
config/general/ags/bar/.gitignore
vendored
2
config/general/ags/bar/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
@girs/
|
|
@ -1,10 +0,0 @@
|
|||||||
import { App } from "astal/gtk3"
|
|
||||||
import style from "./style.scss"
|
|
||||||
import Bar from "./widget/Bar"
|
|
||||||
|
|
||||||
App.start({
|
|
||||||
css: style,
|
|
||||||
main() {
|
|
||||||
App.get_monitors().map(Bar)
|
|
||||||
},
|
|
||||||
})
|
|
21
config/general/ags/bar/env.d.ts
vendored
21
config/general/ags/bar/env.d.ts
vendored
@ -1,21 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "astal-shell",
|
|
||||||
"dependencies": {
|
|
||||||
"astal": "/usr/share/astal/gjs"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strict": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "ES2022",
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
// "checkJs": true,
|
|
||||||
// "allowJs": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "astal/gtk3",
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
import { App, Astal, Gtk, Gdk } from "astal/gtk3"
|
|
||||||
import { Variable } from "astal"
|
|
||||||
|
|
||||||
const time = Variable("").poll(1000, "date")
|
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
|
||||||
|
|
||||||
return <window
|
|
||||||
className="Bar"
|
|
||||||
gdkmonitor={gdkmonitor}
|
|
||||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
|
||||||
anchor={TOP | LEFT | RIGHT}
|
|
||||||
application={App}>
|
|
||||||
<centerbox>
|
|
||||||
<button
|
|
||||||
onClicked="echo hello"
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
Welcome to AGS!
|
|
||||||
</button>
|
|
||||||
<box />
|
|
||||||
<button
|
|
||||||
onClicked={() => print("hello")}
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
<label label={time()} />
|
|
||||||
</button>
|
|
||||||
</centerbox>
|
|
||||||
</window>
|
|
||||||
}
|
|
2
config/general/ags/launcher/.gitignore
vendored
2
config/general/ags/launcher/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
@girs/
|
|
@ -1,10 +0,0 @@
|
|||||||
import { App } from "astal/gtk3"
|
|
||||||
import style from "./style.scss"
|
|
||||||
import Bar from "./widget/Bar"
|
|
||||||
|
|
||||||
App.start({
|
|
||||||
css: style,
|
|
||||||
main() {
|
|
||||||
App.get_monitors().map(Bar)
|
|
||||||
},
|
|
||||||
})
|
|
21
config/general/ags/launcher/env.d.ts
vendored
21
config/general/ags/launcher/env.d.ts
vendored
@ -1,21 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "astal-shell",
|
|
||||||
"dependencies": {
|
|
||||||
"astal": "/usr/share/astal/gjs"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strict": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "ES2022",
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
// "checkJs": true,
|
|
||||||
// "allowJs": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "astal/gtk3",
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
import { App, Astal, Gtk, Gdk } from "astal/gtk3"
|
|
||||||
import { Variable } from "astal"
|
|
||||||
|
|
||||||
const time = Variable("").poll(1000, "date")
|
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
|
||||||
|
|
||||||
return <window
|
|
||||||
className="Bar"
|
|
||||||
gdkmonitor={gdkmonitor}
|
|
||||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
|
||||||
anchor={TOP | LEFT | RIGHT}
|
|
||||||
application={App}>
|
|
||||||
<centerbox>
|
|
||||||
<button
|
|
||||||
onClicked="echo hello"
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
Welcome to AGS!
|
|
||||||
</button>
|
|
||||||
<box />
|
|
||||||
<button
|
|
||||||
onClicked={() => print("hello")}
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
<label label={time()} />
|
|
||||||
</button>
|
|
||||||
</centerbox>
|
|
||||||
</window>
|
|
||||||
}
|
|
2
config/general/ags/notifications/.gitignore
vendored
2
config/general/ags/notifications/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
@girs/
|
|
@ -1,29 +0,0 @@
|
|||||||
import { App } from "astal/gtk3"
|
|
||||||
import style from "./style.scss"
|
|
||||||
|
|
||||||
import not from "./handler"
|
|
||||||
|
|
||||||
App.start({
|
|
||||||
instanceName: "notifier",
|
|
||||||
css: style,
|
|
||||||
main() {
|
|
||||||
not.startNotificationHandler( 0, App.get_monitors()[0] )
|
|
||||||
},
|
|
||||||
requestHandler(request, res) {
|
|
||||||
if ( request == 'show' ) {
|
|
||||||
not.openNotificationMenu( 0 );
|
|
||||||
res( 'Showing all open notifications' );
|
|
||||||
} else if ( request == 'hide' ) {
|
|
||||||
not.closeNotificationMenu( 0 );
|
|
||||||
res( 'Hid all notifications' );
|
|
||||||
} else if ( request == 'clear' ) {
|
|
||||||
not.clearAllNotifications( 0 );
|
|
||||||
res( 'Cleared all notifications' );
|
|
||||||
} else if ( request == 'clear-newest' ) {
|
|
||||||
not.clearNewestNotifications( 0 );
|
|
||||||
res( 'Cleared newest notification' );
|
|
||||||
} else {
|
|
||||||
res( 'Unknown command!' );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
21
config/general/ags/notifications/env.d.ts
vendored
21
config/general/ags/notifications/env.d.ts
vendored
@ -1,21 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
@ -1,184 +0,0 @@
|
|||||||
/*
|
|
||||||
* dotfiles - handler.ts
|
|
||||||
*
|
|
||||||
* Created by Janis Hutz 03/21/2025, Licensed under the GPL V3 License
|
|
||||||
* https://janishutz.com, development@janishutz.com
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { Astal, Gtk, Gdk } from "astal/gtk3"
|
|
||||||
import Notifd from "gi://AstalNotifd";
|
|
||||||
import Notification from "./notifications/notifications";
|
|
||||||
import { type Subscribable } from "astal/binding";
|
|
||||||
import { Variable, bind, timeout } from "astal"
|
|
||||||
|
|
||||||
// Config
|
|
||||||
const TIMEOUT_DELAY = 5000;
|
|
||||||
|
|
||||||
class Notifier implements Subscribable {
|
|
||||||
private display: Map<number, Gtk.Widget> = new Map();
|
|
||||||
private notifications: Map<number, Notifd.Notification> = new Map();
|
|
||||||
|
|
||||||
private notifd: Notifd.Notifd;
|
|
||||||
private subscriberData: Variable<Gtk.Widget[]> = Variable( [] );
|
|
||||||
private instanceID: number;
|
|
||||||
private menuOpen: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets up the notifier
|
|
||||||
*/
|
|
||||||
constructor( id: number ) {
|
|
||||||
this.instanceID = id;
|
|
||||||
this.menuOpen = false;
|
|
||||||
this.notifd = Notifd.get_default();
|
|
||||||
this.notifd.ignoreTimeout = true;
|
|
||||||
|
|
||||||
this.notifd.connect( 'notified', ( _, id ) => {
|
|
||||||
this.add( id );
|
|
||||||
} );
|
|
||||||
|
|
||||||
this.notifd.connect( 'resolved', ( _, id ) => {
|
|
||||||
this.hide( id );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
private notify () {
|
|
||||||
this.subscriberData.set( [ ...this.display.values() ].reverse() );
|
|
||||||
}
|
|
||||||
|
|
||||||
private add ( id: number ) {
|
|
||||||
this.notifications.set( id, this.notifd.get_notification( id )! );
|
|
||||||
this.show( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show an element on screen
|
|
||||||
* @param id - The id of the element to be shown
|
|
||||||
*/
|
|
||||||
private show ( id: number ) {
|
|
||||||
this.set( id, Notification( {
|
|
||||||
notification: this.notifications.get( id )!,
|
|
||||||
onHoverLost: () => this.hide( id ),
|
|
||||||
setup: () => timeout( TIMEOUT_DELAY, () => {
|
|
||||||
if ( !this.menuOpen ) {
|
|
||||||
this.hide( id );
|
|
||||||
}
|
|
||||||
} ),
|
|
||||||
id: id,
|
|
||||||
delete: deleteHelper,
|
|
||||||
instanceID: this.instanceID
|
|
||||||
} ) )
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a selected widget to be shown
|
|
||||||
* @param id - The id of the element to be referenced for later
|
|
||||||
* @param widget - A GTK widget instance
|
|
||||||
*/
|
|
||||||
private set ( id: number, widget: Gtk.Widget ) {
|
|
||||||
this.display.get( id )?.destroy();
|
|
||||||
this.display.set( id, widget );
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Hide, not delete notification (= send to notification centre)
|
|
||||||
* @param id - The id of the notification to hide
|
|
||||||
*/
|
|
||||||
private hide ( id: number ) {
|
|
||||||
this.display.get( id )?.destroy();
|
|
||||||
this.display.delete( id );
|
|
||||||
this.notify();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete a notification (from notification centre too)
|
|
||||||
* @param id - The id of the notification to hide
|
|
||||||
*/
|
|
||||||
delete ( id: number ) {
|
|
||||||
this.hide( id );
|
|
||||||
this.notifications.get( id )?.dismiss();
|
|
||||||
this.notifications.delete( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
openNotificationMenu () {
|
|
||||||
// Show all notifications that have not been cleared
|
|
||||||
this.menuOpen = true;
|
|
||||||
this.notifications.forEach( ( _, id ) => {
|
|
||||||
this.show( id );
|
|
||||||
} )
|
|
||||||
}
|
|
||||||
|
|
||||||
hideNotifications () {
|
|
||||||
this.menuOpen = false;
|
|
||||||
this.notifications.forEach( ( _, id ) => {
|
|
||||||
this.hide( id );
|
|
||||||
} )
|
|
||||||
}
|
|
||||||
|
|
||||||
clearAllNotifications () {
|
|
||||||
this.menuOpen = false;
|
|
||||||
this.notifications.forEach( ( _, id ) => {
|
|
||||||
this.delete( id );
|
|
||||||
} )
|
|
||||||
}
|
|
||||||
|
|
||||||
clearNewestNotification () {
|
|
||||||
this.delete( [ ...this.notifications.keys() ][0] );
|
|
||||||
}
|
|
||||||
|
|
||||||
subscribe(callback: (value: unknown) => void): () => void {
|
|
||||||
return this.subscriberData.subscribe( callback );
|
|
||||||
}
|
|
||||||
|
|
||||||
get() {
|
|
||||||
return this.subscriberData.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const notifiers: Map<number, Notifier> = new Map();
|
|
||||||
const deleteHelper = ( id: number, instanceID: number ) => {
|
|
||||||
notifiers.get( instanceID )?.delete( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
const openNotificationMenu = ( id: number ) => {
|
|
||||||
notifiers.get( id )?.openNotificationMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
const closeNotificationMenu = ( id: number ) => {
|
|
||||||
notifiers.get( id )?.hideNotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
const clearAllNotifications = ( id: number ) => {
|
|
||||||
notifiers.get( id )?.clearAllNotifications();
|
|
||||||
}
|
|
||||||
|
|
||||||
const clearNewestNotifications = ( id: number ) => {
|
|
||||||
notifiers.get( id )?.clearNewestNotification();
|
|
||||||
}
|
|
||||||
|
|
||||||
const startNotificationHandler = (id: number, gdkmonitor: Gdk.Monitor) => {
|
|
||||||
const { TOP, RIGHT } = Astal.WindowAnchor
|
|
||||||
const notifier: Notifier = new Notifier( id );
|
|
||||||
notifiers.set( id, notifier );
|
|
||||||
|
|
||||||
return <window
|
|
||||||
className="NotificationHandler"
|
|
||||||
gdkmonitor={gdkmonitor}
|
|
||||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
|
||||||
anchor={TOP | RIGHT}>
|
|
||||||
<box vertical noImplicitDestroy>
|
|
||||||
{bind(notifier)}
|
|
||||||
</box>
|
|
||||||
</window>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
|
||||||
startNotificationHandler,
|
|
||||||
openNotificationMenu,
|
|
||||||
closeNotificationMenu,
|
|
||||||
clearAllNotifications,
|
|
||||||
clearNewestNotifications
|
|
||||||
}
|
|
@ -1,125 +0,0 @@
|
|||||||
@use "sass:string";
|
|
||||||
|
|
||||||
@function gtkalpha($c, $a) {
|
|
||||||
@return string.unquote("alpha(#{$c},#{$a})");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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"};
|
|
||||||
$error: red;
|
|
||||||
|
|
||||||
window.NotificationPopups {
|
|
||||||
all: unset;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventbox.Notification {
|
|
||||||
|
|
||||||
&:first-child>box {
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child>box {
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
// eventboxes can not take margins so we style its inner box instead
|
|
||||||
>box {
|
|
||||||
min-width: 400px;
|
|
||||||
border-radius: 13px;
|
|
||||||
background-color: $bg-color;
|
|
||||||
margin: .5rem 1rem .5rem 1rem;
|
|
||||||
box-shadow: 2px 3px 8px 0 gtkalpha(black, .4);
|
|
||||||
border: 1pt solid gtkalpha($fg-color, .03);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.critical>box {
|
|
||||||
border: 1pt solid gtkalpha($error, .4);
|
|
||||||
|
|
||||||
.header {
|
|
||||||
|
|
||||||
.app-name {
|
|
||||||
color: gtkalpha($error, .8);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-icon {
|
|
||||||
color: gtkalpha($error, .6);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
padding: .5rem;
|
|
||||||
color: gtkalpha($fg-color, 0.5);
|
|
||||||
|
|
||||||
.app-icon {
|
|
||||||
margin: 0 .4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.app-name {
|
|
||||||
margin-right: .3rem;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-left: .4rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.time {
|
|
||||||
margin: 0 .4rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: .2rem;
|
|
||||||
min-width: 0;
|
|
||||||
min-height: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
separator {
|
|
||||||
margin: 0 .4rem;
|
|
||||||
background-color: gtkalpha($fg-color, .1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
margin: 1rem;
|
|
||||||
margin-top: .5rem;
|
|
||||||
|
|
||||||
.summary {
|
|
||||||
font-size: 1.2em;
|
|
||||||
color: $fg-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
.body {
|
|
||||||
color: gtkalpha($fg-color, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
.image {
|
|
||||||
border: 1px solid gtkalpha($fg-color, .02);
|
|
||||||
margin-right: .5rem;
|
|
||||||
border-radius: 9px;
|
|
||||||
min-width: 100px;
|
|
||||||
min-height: 100px;
|
|
||||||
background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
margin: 1rem;
|
|
||||||
margin-top: 0;
|
|
||||||
|
|
||||||
button {
|
|
||||||
margin: 0 .3rem;
|
|
||||||
|
|
||||||
&:first-child {
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:last-child {
|
|
||||||
margin-right: 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
// From astal examples
|
|
||||||
|
|
||||||
import { GLib } from "astal"
|
|
||||||
import { Gtk, Astal } from "astal/gtk3"
|
|
||||||
import { type EventBox } from "astal/gtk3/widget"
|
|
||||||
import Notifd from "gi://AstalNotifd"
|
|
||||||
|
|
||||||
const isIcon = (icon: string) =>
|
|
||||||
!!Astal.Icon.lookup_icon(icon)
|
|
||||||
|
|
||||||
const fileExists = (path: string) =>
|
|
||||||
GLib.file_test(path, GLib.FileTest.EXISTS)
|
|
||||||
|
|
||||||
const time = (time: number, format = "%H:%M") => GLib.DateTime
|
|
||||||
.new_from_unix_local(time)
|
|
||||||
.format(format)!
|
|
||||||
|
|
||||||
const urgency = (n: Notifd.Notification) => {
|
|
||||||
const { LOW, NORMAL, CRITICAL } = Notifd.Urgency
|
|
||||||
// match operator when?
|
|
||||||
switch (n.urgency) {
|
|
||||||
case LOW: return "low"
|
|
||||||
case CRITICAL: return "critical"
|
|
||||||
case NORMAL:
|
|
||||||
default: return "normal"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type Props = {
|
|
||||||
delete( id: number, instanceID: number ): void
|
|
||||||
setup(self: EventBox): void
|
|
||||||
onHoverLost(self: EventBox): void
|
|
||||||
notification: Notifd.Notification
|
|
||||||
id: number
|
|
||||||
instanceID: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function Notification(props: Props) {
|
|
||||||
const { notification: n, onHoverLost, setup, id: id, delete: del, instanceID: instance } = props
|
|
||||||
const { START, CENTER, END } = Gtk.Align
|
|
||||||
|
|
||||||
return <eventbox
|
|
||||||
className={`Notification ${urgency(n)}`}
|
|
||||||
setup={setup}
|
|
||||||
onHoverLost={onHoverLost}>
|
|
||||||
<box vertical>
|
|
||||||
<box className="header">
|
|
||||||
{(n.appIcon || n.desktopEntry) && <icon
|
|
||||||
className="app-icon"
|
|
||||||
visible={Boolean(n.appIcon || n.desktopEntry)}
|
|
||||||
icon={n.appIcon || n.desktopEntry}
|
|
||||||
/>}
|
|
||||||
<label
|
|
||||||
className="app-name"
|
|
||||||
halign={START}
|
|
||||||
truncate
|
|
||||||
label={n.appName || "Unknown"}
|
|
||||||
/>
|
|
||||||
<label
|
|
||||||
className="time"
|
|
||||||
hexpand
|
|
||||||
halign={END}
|
|
||||||
label={time(n.time)}
|
|
||||||
/>
|
|
||||||
<button onClicked={() => del( id, instance )}>
|
|
||||||
<icon icon="window-close-symbolic" />
|
|
||||||
</button>
|
|
||||||
</box>
|
|
||||||
<Gtk.Separator visible />
|
|
||||||
<box className="content">
|
|
||||||
{n.image && fileExists(n.image) && <box
|
|
||||||
valign={START}
|
|
||||||
className="image"
|
|
||||||
css={`background-image: url('${n.image}')`}
|
|
||||||
/>}
|
|
||||||
{n.image && isIcon(n.image) && <box
|
|
||||||
expand={false}
|
|
||||||
valign={START}
|
|
||||||
className="icon-image">
|
|
||||||
<icon icon={n.image} expand halign={CENTER} valign={CENTER} />
|
|
||||||
</box>}
|
|
||||||
<box vertical>
|
|
||||||
<label
|
|
||||||
className="summary"
|
|
||||||
halign={START}
|
|
||||||
xalign={0}
|
|
||||||
label={n.summary}
|
|
||||||
truncate
|
|
||||||
/>
|
|
||||||
{n.body && <label
|
|
||||||
className="body"
|
|
||||||
wrap
|
|
||||||
useMarkup
|
|
||||||
halign={START}
|
|
||||||
xalign={0}
|
|
||||||
justifyFill
|
|
||||||
label={n.body}
|
|
||||||
/>}
|
|
||||||
</box>
|
|
||||||
</box>
|
|
||||||
{n.get_actions().length > 0 && <box className="actions">
|
|
||||||
{n.get_actions().map(({ label, id }) => (
|
|
||||||
<button
|
|
||||||
hexpand
|
|
||||||
onClicked={() => n.invoke(id)}>
|
|
||||||
<label label={label} halign={CENTER} hexpand />
|
|
||||||
</button>
|
|
||||||
))}
|
|
||||||
</box>}
|
|
||||||
</box>
|
|
||||||
</eventbox>
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "astal-shell",
|
|
||||||
"dependencies": {
|
|
||||||
"astal": "/usr/share/astal/gjs"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
// Import notification box style
|
|
||||||
@use "./notifications/notifications.scss"
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strict": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "ES2022",
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
// "checkJs": true,
|
|
||||||
// "allowJs": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "astal/gtk3",
|
|
||||||
}
|
|
||||||
}
|
|
2
config/general/ags/quickactions/.gitignore
vendored
2
config/general/ags/quickactions/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
node_modules/
|
|
||||||
@girs/
|
|
@ -1,10 +0,0 @@
|
|||||||
import { App } from "astal/gtk3"
|
|
||||||
import style from "./style.scss"
|
|
||||||
import Bar from "./widget/Bar"
|
|
||||||
|
|
||||||
App.start({
|
|
||||||
css: style,
|
|
||||||
main() {
|
|
||||||
App.get_monitors().map(Bar)
|
|
||||||
},
|
|
||||||
})
|
|
21
config/general/ags/quickactions/env.d.ts
vendored
21
config/general/ags/quickactions/env.d.ts
vendored
@ -1,21 +0,0 @@
|
|||||||
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
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "astal-shell",
|
|
||||||
"dependencies": {
|
|
||||||
"astal": "/usr/share/astal/gjs"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
|
||||||
"compilerOptions": {
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"strict": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "ES2022",
|
|
||||||
"moduleResolution": "Bundler",
|
|
||||||
// "checkJs": true,
|
|
||||||
// "allowJs": true,
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"jsxImportSource": "astal/gtk3",
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
import { App, Astal, Gtk, Gdk } from "astal/gtk3"
|
|
||||||
import { Variable } from "astal"
|
|
||||||
|
|
||||||
const time = Variable("").poll(1000, "date")
|
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor
|
|
||||||
|
|
||||||
return <window
|
|
||||||
className="Bar"
|
|
||||||
gdkmonitor={gdkmonitor}
|
|
||||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
|
||||||
anchor={TOP | LEFT | RIGHT}
|
|
||||||
application={App}>
|
|
||||||
<centerbox>
|
|
||||||
<button
|
|
||||||
onClicked="echo hello"
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
Welcome to AGS!
|
|
||||||
</button>
|
|
||||||
<box />
|
|
||||||
<button
|
|
||||||
onClicked={() => print("hello")}
|
|
||||||
halign={Gtk.Align.CENTER}
|
|
||||||
>
|
|
||||||
<label label={time()} />
|
|
||||||
</button>
|
|
||||||
</centerbox>
|
|
||||||
</window>
|
|
||||||
}
|
|
Before Width: | Height: | Size: 712 KiB After Width: | Height: | Size: 712 KiB |
59
scripts/ethz-vpn
Executable file
59
scripts/ethz-vpn
Executable file
@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
connect() {
|
||||||
|
read -sp $'Please type in your Encryption Password:\n' encpass
|
||||||
|
TOKEN=$(cat ~/.local/share/ethz-vpn-connect/ethzvpntoken.secret | openssl enc -aes-256-cbc -pbkdf2 -d -a -k $encpass)
|
||||||
|
PASSWORD=$(cat ~/.local/share/ethz-vpn-connect/ethzvpnpass.secret | openssl enc -aes-256-cbc -pbkdf2 -d -a -k $encpass)
|
||||||
|
USERNAME=$(cat ~/.local/share/ethz-vpn-connect/ethzvpnusername.txt)
|
||||||
|
echo $PASSWORD | sudo openconnect -b -u $USERNAME@student-net.ethz.ch -g student-net --useragent=AnyConnect --passwd-on-stdin --token-mode=totp --token-secret=sha1:base32:$TOKEN sslvpn.ethz.ch
|
||||||
|
encpass=""
|
||||||
|
PASSWORD=""
|
||||||
|
TOKEN=""
|
||||||
|
}
|
||||||
|
|
||||||
|
disconnect() {
|
||||||
|
sudo killall -v -SIGINT openconnect #add -i option to ask for confirmation, usefull if running multible openconnect.
|
||||||
|
}
|
||||||
|
|
||||||
|
setup() {
|
||||||
|
echo 'You are about to overwrite your secrets. Press ctrl + C to cancel.'
|
||||||
|
read -p $'Please type in your Username: ' USERNAME
|
||||||
|
echo 'Ok!'
|
||||||
|
read -sp $'Please type in your Encryption Password: ' encpass
|
||||||
|
echo 'Ok!'
|
||||||
|
read -sp $'Please type in your ETHZ WLAN Password: ' PASSWORD
|
||||||
|
echo 'Ok!'
|
||||||
|
read -sp $'Please type in your ETHZ OTP Secret: ' TOKEN
|
||||||
|
mkdir ~/.local/share/ethz-vpn-connect
|
||||||
|
echo $PASSWORD | openssl enc -aes-256-cbc -pbkdf2 -a -k $encpass >~/.local/share/ethz-vpn-connect/ethzvpnpass.secret
|
||||||
|
echo $TOKEN | openssl enc -aes-256-cbc -pbkdf2 -a -k $encpass >~/.local/share/ethz-vpn-connect/ethzvpntoken.secret
|
||||||
|
echo $USERNAME >~/.local/share/ethz-vpn-connect/ethzvpnusername.txt
|
||||||
|
encpass=""
|
||||||
|
PASSWORD=""
|
||||||
|
TOKEN=""
|
||||||
|
echo $'Secrets set\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
'connect')
|
||||||
|
connect
|
||||||
|
;;
|
||||||
|
c)
|
||||||
|
connect
|
||||||
|
;;
|
||||||
|
'disconnect')
|
||||||
|
disconnect
|
||||||
|
;;
|
||||||
|
d)
|
||||||
|
disconnect
|
||||||
|
;;
|
||||||
|
dc)
|
||||||
|
disconnect
|
||||||
|
;;
|
||||||
|
setup)
|
||||||
|
setup
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo -e 'Usage: ethz-vpn [Option] \n [Option]: \n connect, c: Connect VPN \n disconnect, d, dc: Disconnect VPN \n setup: set secrets and eth-Kürzel.\n'
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
x
Reference in New Issue
Block a user