fix(ags): launch apps detached from ags
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
aa7b215055
commit
2216e1414d
4 changed files with 33 additions and 4 deletions
|
@ -2,8 +2,9 @@ const { Box, Icon, Label } = Widget;
|
|||
const { lookUpIcon } = Utils;
|
||||
|
||||
import CursorBox from '../misc/cursorbox.ts';
|
||||
import { launchApp } from './launch.ts';
|
||||
|
||||
// Types
|
||||
/* Types */
|
||||
import { Application } from 'types/service/applications.ts';
|
||||
|
||||
|
||||
|
@ -55,7 +56,7 @@ export default (app: Application) => {
|
|||
|
||||
on_primary_click_release: () => {
|
||||
App.closeWindow('win-applauncher');
|
||||
app.launch();
|
||||
launchApp(app);
|
||||
},
|
||||
|
||||
child: Box({
|
||||
|
|
26
modules/ags/config/ts/applauncher/launch.ts
Normal file
26
modules/ags/config/ts/applauncher/launch.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
/* Types */
|
||||
import { Application } from 'types/service/applications.ts';
|
||||
|
||||
|
||||
const bash = async(strings: TemplateStringsArray | string, ...values: unknown[]) => {
|
||||
const cmd = typeof strings === 'string' ?
|
||||
strings :
|
||||
strings.flatMap((str, i) => `${str }${values[i] ?? ''}`)
|
||||
.join('');
|
||||
|
||||
return Utils.execAsync(['bash', '-c', cmd]).catch((err) => {
|
||||
console.error(cmd, err);
|
||||
|
||||
return '';
|
||||
});
|
||||
};
|
||||
|
||||
export const launchApp = (app: Application) => {
|
||||
const exe = app.executable
|
||||
.split(/\s+/)
|
||||
.filter((str) => !str.startsWith('%') && !str.startsWith('@'))
|
||||
.join(' ');
|
||||
|
||||
bash(`${exe} &`);
|
||||
app.frequency += 1;
|
||||
};
|
|
@ -5,6 +5,7 @@ import { Fzf, FzfResultItem } from 'fzf';
|
|||
|
||||
import PopupWindow from '../misc/popup.ts';
|
||||
import AppItem from './app-item.ts';
|
||||
import { launchApp } from './launch.ts';
|
||||
|
||||
// Types
|
||||
import { ListBoxRow } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
|
||||
|
@ -72,7 +73,7 @@ const Applauncher = (window_name = 'applauncher') => {
|
|||
|
||||
if (appList[0]) {
|
||||
App.closeWindow(`win-${window_name}`);
|
||||
appList[0].launch();
|
||||
launchApp(appList[0]);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ const { GLib } = imports.gi;
|
|||
|
||||
import Gesture from './gesture.ts';
|
||||
import CursorBox from '../misc/cursorbox.ts';
|
||||
import { launchApp } from '../applauncher/launch.ts';
|
||||
|
||||
// Types
|
||||
import { Notification as NotifObj } from 'types/service/notifications.ts';
|
||||
|
@ -89,7 +90,7 @@ const NotificationIcon = (notif: NotifObj) => {
|
|||
else {
|
||||
Hyprland.messageAsync('dispatch workspace empty')
|
||||
.then(() => {
|
||||
app.launch();
|
||||
launchApp(app);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue