Skip to content

Commit

Permalink
Merge main into feature/taskservice
Browse files Browse the repository at this point in the history
  • Loading branch information
kotontrion committed Jan 1, 2024
2 parents 6aad220 + 6a89299 commit 557e062
Show file tree
Hide file tree
Showing 68 changed files with 2,746 additions and 2,360 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ rules:
- 'off'
'@typescript-eslint/no-non-null-assertion':
- 'off'
'@typescript-eslint/no-explicit-any':
- 'off'
'@typescript-eslint/no-unused-vars':
- error
# Vars use a suffix _ instead of a prefix because of file-scope private vars
- varsIgnorePattern: (^unused|_$)
argsIgnorePattern: ^(unused|_)

Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/cachix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Binary Cache

on: [push, pull_request, workflow_dispatch]
jobs:
nix:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- uses: DeterminateSystems/nix-installer-action@main
with:
logger: pretty
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v12
with:
name: ags
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build ags
run: nix build --print-build-logs
35 changes: 33 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,46 @@
# Unreleased

## Features
- feat: Service.bind and Variable.bind
- feat: AgsWidget.register
- export Widget.createCtor utility
- add: Applications.reload
- add: Utils.idle
- use GLib.shell_parse_argv on Utils.execAsync
- feat: Utils.fetch
- overwrite toJSON method on GObjects
- feat: PowerProfile Service

## Breaking Changes
- update: Hyprland.active.monitor to be an object

# 1.5.5

## Features
- feat: support print from client with --run-js
- feat: support shebang with --run-file
- add: Utils.monitorFile
- feat: Utils.readFile and readFileAsync can take a Gio.File
- improve Button, EventBox hover events
- parse passed files starting with .
- feat: binds targetProp can be in kebab, camel or snake case too
- add: hook, on, poll, bind, attribute

# 1.5.4

## Features
- add: notificationForceTimeout option
- add: bluetooth device-added, device-removed signal
- add: cursor property
- feat: window popup close on click away
- add: config.onWindowToggled & config.onConfigParsed
- add: marks property setter to slider #186
- feat: --run-js async support
- add: --run-file

## Breaking Changes

- feat: Window.exclusivity
- deprecate: --run-promise cli flag

## Fixes

- overlay pass-through #168
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ Currently, only Wayland is supported, but it also works on X11, [see #19](https:

## Get started

To get started read the [wiki](https://github.com/Aylur/ags/wiki).
To get started read the [wiki](https://aylur.github.io/ags-docs).
38 changes: 38 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Planned features/improvements

- services
- [x] power profiles [#218](https://github.com/Aylur/ags/pull/218)
- [ ] greetd - this would allow to create login managers
- [ ] evolution data server - allows for to sync with calendars, todos and contact lists
- [ ] improve Network service - its currently very barebones, and state changes are not properly signaled

- [ ] utility gobject based library in c
- to be able to use wayland protocols especially for lockscreens in the form of a PAM util function for authentication and input inhibitor

- [x] fetch util function [#187](https://github.com/Aylur/ags/pull/187)
- [x] toJSON overridies [#203](https://github.com/Aylur/ags/pull/203)

- [ ] circular slider widget

- subclass more widget
- [ ] Gtk.Fixed
- [ ] Gtk.Grid

- Nix
- [ ] NixOS module
- [x] binary cache [#212](https://github.com/Aylur/ags/pull/212)

- [ ] github action to package types
- [ ] maybe? install them at /etc/ags with meson

- Wiki
- [x] update to use `bind` `hook` `on` `poll`
- [ ] update examples
- [ ] Frequent GTK issues page
- [ ] Single children issues

- [ ] Move wiki to aylur.github.io/ags
- maybe? rename id from com.github.Aylur.ags to io.Aylur.ags


- [ ] add JSDoc to most stuff
108 changes: 108 additions & 0 deletions example/applauncher/applauncher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import App from 'resource:///com/github/Aylur/ags/app.js';
import Applications from 'resource:///com/github/Aylur/ags/service/applications.js';

const WINDOW_NAME = 'applauncher';

/** @param {import('resource:///com/github/Aylur/ags/service/applications.js').Application} app */
const AppItem = app => Widget.Button({
on_clicked: () => {
App.closeWindow(WINDOW_NAME);
app.launch();
},
attribute: { app },
child: Widget.Box({
children: [
Widget.Icon({
icon: app.icon_name || '',
size: 42,
}),
Widget.Label({
class_name: 'title',
label: app.name,
xalign: 0,
vpack: 'center',
truncate: 'end',
}),
],
}),
});

const Applauncher = ({ width = 500, height = 500, spacing = 12 }) => {
// list of application buttons
let applications = Applications.query('').map(AppItem);

// container holding the buttons
const list = Widget.Box({
vertical: true,
children: applications,
spacing,
});

// repopulate the box, so the most frequent apps are on top of the list
function repopulate() {
applications = Applications.query('').map(AppItem);
list.children = applications;
}

// search entry
const entry = Widget.Entry({
hexpand: true,
css: `margin-bottom: ${spacing}px;`,

// to launch the first item on Enter
on_accept: () => {
if (applications[0]) {
App.toggleWindow(WINDOW_NAME);
applications[0].attribute.app.launch();
}
},

// filter out the list
on_change: ({ text }) => applications.forEach(item => {
item.visible = item.attribute.app.match(text);
}),
});

return Widget.Box({
vertical: true,
css: `margin: ${spacing * 2}px;`,
children: [
entry,

// wrap the list in a scrollable
Widget.Scrollable({
hscroll: 'never',
css: `
min-width: ${width}px;
min-height: ${height}px;
`,
child: list,
}),
],
setup: self => self.hook(App, (_, windowName, visible) => {
if (windowName !== WINDOW_NAME)
return;

// when the applauncher shows up
if (visible) {
repopulate();
entry.text = '';
entry.grab_focus();
}
}),
});
};

// there needs to be only one instance
export const applauncher = Widget.Window({
name: WINDOW_NAME,
popup: true,
visible: false,
focusable: true,
child: Applauncher({
width: 500,
height: 500,
spacing: 12,
}),
});
117 changes: 1 addition & 116 deletions example/applauncher/config.js
Original file line number Diff line number Diff line change
@@ -1,119 +1,4 @@
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import App from 'resource:///com/github/Aylur/ags/app.js';
import Applications from 'resource:///com/github/Aylur/ags/service/applications.js';

const WINDOW_NAME = 'applauncher';

/** @param {import('resource:///com/github/Aylur/ags/service/applications.js').Application} app */
const AppItem = app => Widget.Button({
on_clicked: () => {
App.closeWindow(WINDOW_NAME);
app.launch();
},
setup: self => self.app = app,
child: Widget.Box({
children: [
Widget.Icon({
icon: app.icon_name || '',
size: 42,
}),
Widget.Box({
vertical: true,
vpack: 'center',
children: [
Widget.Label({
class_name: 'title',
label: app.name,
xalign: 0,
vpack: 'center',
truncate: 'end',
}),
// short circuit if there is no description
!!app.description && Widget.Label({
class_name: 'description',
label: app.description || '',
wrap: true,
xalign: 0,
justification: 'left',
vpack: 'center',
}),
],
}),
],
}),
});

const Applauncher = ({ width = 500, height = 500, spacing = 12 } = {}) => {
const list = Widget.Box({
vertical: true,
spacing,
});

const entry = Widget.Entry({
hexpand: true,
css: `margin-bottom: ${spacing}px;`,

// set some text so on-change works the first time
text: '-',

// to launch the first item on Enter
on_accept: ({ text }) => {
const list = Applications.query(text || '');
if (list[0]) {
App.toggleWindow(WINDOW_NAME);
list[0].launch();
}
},

// filter out the list
on_change: ({ text }) => list.children.map(item => {
item.visible = item.app.match(text);
}),
});

return Widget.Box({
vertical: true,
css: `margin: ${spacing * 2}px;`,
children: [
entry,

// wrap the list in a scrollable
Widget.Scrollable({
hscroll: 'never',
css: `
min-width: ${width}px;
min-height: ${height}px;
`,
child: list,
}),
],

// make entry.text empty on launch
// and update the list's children so it is sorted by frequency
connections: [[App, (_, name, visible) => {
if (name !== WINDOW_NAME)
return;

list.children = Applications.list.map(AppItem);

entry.text = '';
if (visible)
entry.grab_focus();
}]],
});
};

const applauncher = Widget.Window({
name: WINDOW_NAME,
popup: true,
visible: false,
focusable: true,
child: Applauncher({
width: 500,
height: 500,
spacing: 12,
}),
});
import { applauncher } from './applauncher.js';

export default {
windows: [applauncher],
Expand Down
Loading

0 comments on commit 557e062

Please sign in to comment.