feat: uwsm app -> app2unit
Also xdg-open -> app2unit
This commit is contained in:
parent
df1928e0d0
commit
aed36b160f
6 changed files with 19 additions and 16 deletions
|
|
@ -7,7 +7,7 @@ import { bindCurrentTime, osIcon } from "@/utils/system";
|
||||||
import type { AstalWidget } from "@/utils/types";
|
import type { AstalWidget } from "@/utils/types";
|
||||||
import { setupCustomTooltip } from "@/utils/widgets";
|
import { setupCustomTooltip } from "@/utils/widgets";
|
||||||
import ScreenCorner from "@/widgets/screencorner";
|
import ScreenCorner from "@/widgets/screencorner";
|
||||||
import { execAsync, Variable } from "astal";
|
import { execAsync, GLib, Variable } from "astal";
|
||||||
import { bind, kebabify } from "astal/binding";
|
import { bind, kebabify } from "astal/binding";
|
||||||
import { App, Astal, Gtk, Widget } from "astal/gtk3";
|
import { App, Astal, Gtk, Widget } from "astal/gtk3";
|
||||||
import { bar as config } from "config";
|
import { bar as config } from "config";
|
||||||
|
|
@ -294,13 +294,16 @@ const Network = ({ monitor }: { monitor: Monitor }) => (
|
||||||
const network = AstalNetwork.get_default();
|
const network = AstalNetwork.get_default();
|
||||||
if (event.button === Astal.MouseButton.PRIMARY) switchPane(monitor, "connectivity");
|
if (event.button === Astal.MouseButton.PRIMARY) switchPane(monitor, "connectivity");
|
||||||
else if (event.button === Astal.MouseButton.SECONDARY) network.wifi.enabled = !network.wifi.enabled;
|
else if (event.button === Astal.MouseButton.SECONDARY) network.wifi.enabled = !network.wifi.enabled;
|
||||||
else if (event.button === Astal.MouseButton.MIDDLE)
|
else if (event.button === Astal.MouseButton.MIDDLE) {
|
||||||
execAsync("uwsm app -- gnome-control-center wifi").catch(() => {
|
if (GLib.find_program_in_path("gnome-control-center"))
|
||||||
|
execAsync("app2unit -- gnome-control-center wifi").catch(console.error);
|
||||||
|
else {
|
||||||
network.wifi.scan();
|
network.wifi.scan();
|
||||||
execAsync(
|
execAsync(
|
||||||
"uwsm app -- foot -T nmtui -- fish -c 'sleep .1; set -e COLORTERM; TERM=xterm-old nmtui connect'"
|
"app2unit -- foot -T nmtui -- fish -c 'sleep .1; set -e COLORTERM; TERM=xterm-old nmtui connect'"
|
||||||
).catch(() => {}); // Ignore errors
|
).catch(() => {}); // Ignore errors
|
||||||
});
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
setup={self => {
|
setup={self => {
|
||||||
const network = AstalNetwork.get_default();
|
const network = AstalNetwork.get_default();
|
||||||
|
|
@ -399,7 +402,7 @@ const BluetoothDevice = ({ monitor, device }: { monitor: Monitor; device: AstalB
|
||||||
else if (event.button === Astal.MouseButton.SECONDARY)
|
else if (event.button === Astal.MouseButton.SECONDARY)
|
||||||
device.disconnect_device((_, res) => device.disconnect_device_finish(res));
|
device.disconnect_device((_, res) => device.disconnect_device_finish(res));
|
||||||
else if (event.button === Astal.MouseButton.MIDDLE)
|
else if (event.button === Astal.MouseButton.MIDDLE)
|
||||||
execAsync("uwsm app -- blueman-manager").catch(console.error);
|
execAsync("app2unit -- blueman-manager").catch(console.error);
|
||||||
}}
|
}}
|
||||||
setup={self => setupCustomTooltip(self, bind(device, "alias"))}
|
setup={self => setupCustomTooltip(self, bind(device, "alias"))}
|
||||||
>
|
>
|
||||||
|
|
@ -418,7 +421,7 @@ const Bluetooth = ({ monitor }: { monitor: Monitor }) => (
|
||||||
if (event.button === Astal.MouseButton.PRIMARY) switchPane(monitor, "connectivity");
|
if (event.button === Astal.MouseButton.PRIMARY) switchPane(monitor, "connectivity");
|
||||||
else if (event.button === Astal.MouseButton.SECONDARY) AstalBluetooth.get_default().toggle();
|
else if (event.button === Astal.MouseButton.SECONDARY) AstalBluetooth.get_default().toggle();
|
||||||
else if (event.button === Astal.MouseButton.MIDDLE)
|
else if (event.button === Astal.MouseButton.MIDDLE)
|
||||||
execAsync("uwsm app -- blueman-manager").catch(console.error);
|
execAsync("app2unit -- blueman-manager").catch(console.error);
|
||||||
}}
|
}}
|
||||||
setup={self => {
|
setup={self => {
|
||||||
const bluetooth = AstalBluetooth.get_default();
|
const bluetooth = AstalBluetooth.get_default();
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ const actions = (mode: Variable<Mode>, entry: Widget.Entry): ActionMap => ({
|
||||||
View: () => {
|
View: () => {
|
||||||
const client = AstalHyprland.get_default().clients.find(c => c.class === "Todoist");
|
const client = AstalHyprland.get_default().clients.find(c => c.class === "Todoist");
|
||||||
if (client) client.focus();
|
if (client) client.focus();
|
||||||
else execAsync("uwsm app -- todoist").catch(console.error);
|
else execAsync("app2unit -- todoist").catch(console.error);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ const FileResult = ({ path }: { path: string }) => (
|
||||||
execAsync([
|
execAsync([
|
||||||
"bash",
|
"bash",
|
||||||
"-c",
|
"-c",
|
||||||
`dbus-send --session --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file://${path}" string:"" || xdg-open "${path}"`,
|
`dbus-send --session --dest=org.freedesktop.FileManager1 --type=method_call /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:'file://${path}' string:'' || app2unit -O '${path}'`,
|
||||||
]).catch(console.error);
|
]).catch(console.error);
|
||||||
close();
|
close();
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ const constructItem = (label: string, exec: string, quiet = true) =>
|
||||||
|
|
||||||
const Update = (update: IUpdate) => {
|
const Update = (update: IUpdate) => {
|
||||||
const menu = new Gtk.Menu();
|
const menu = new Gtk.Menu();
|
||||||
menu.append(constructItem("Open info in browser", `xdg-open '${update.url}'`, false));
|
menu.append(constructItem("Open info in browser", `app2unit -O '${update.url}'`, false));
|
||||||
menu.append(constructItem("Open info in terminal", `uwsm app -- foot -H -- pacman -Qi ${update.name}`));
|
menu.append(constructItem("Open info in terminal", `app2unit -- foot -H -- pacman -Qi ${update.name}`));
|
||||||
menu.append(new Gtk.SeparatorMenuItem({ visible: true }));
|
menu.append(new Gtk.SeparatorMenuItem({ visible: true }));
|
||||||
menu.append(constructItem("Reinstall", `uwsm app -- foot -H -- yay -S ${update.name}`));
|
menu.append(constructItem("Reinstall", `app2unit -- foot -H -- yay -S ${update.name}`));
|
||||||
menu.append(constructItem("Remove with dependencies", `uwsm app -- foot -H -- yay -Rns ${update.name}`));
|
menu.append(constructItem("Remove with dependencies", `app2unit -- foot -H -- yay -Rns ${update.name}`));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ export default class Weather extends GObject.Object {
|
||||||
icon: "dialog-warning-symbolic",
|
icon: "dialog-warning-symbolic",
|
||||||
urgency: "critical",
|
urgency: "critical",
|
||||||
actions: {
|
actions: {
|
||||||
"Get API key": () => execAsync(["xdg-open", "https://www.weatherapi.com"]).catch(print),
|
"Get API key": () => execAsync(`app2unit -O 'https://www.weatherapi.com'`).catch(print),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,11 @@ const execToCmd = (app: AstalApps.Application) => {
|
||||||
|
|
||||||
export const launch = (app: AstalApps.Application) => {
|
export const launch = (app: AstalApps.Application) => {
|
||||||
let now = Date.now();
|
let now = Date.now();
|
||||||
execAsync(["uwsm", "app", "--", app.entry]).catch(() => {
|
execAsync(["app2unit", "--", app.entry]).catch(() => {
|
||||||
// Try manual exec if launch fails (exits with error within 1 second)
|
// Try manual exec if launch fails (exits with error within 1 second)
|
||||||
if (Date.now() - now < 1000) {
|
if (Date.now() - now < 1000) {
|
||||||
now = Date.now();
|
now = Date.now();
|
||||||
execAsync(["uwsm", "app", "--", execToCmd(app)]).catch(() => {
|
execAsync(["app2unit", "--", execToCmd(app)]).catch(() => {
|
||||||
// Fallback to regular launch
|
// Fallback to regular launch
|
||||||
if (Date.now() - now < 1000) {
|
if (Date.now() - now < 1000) {
|
||||||
app.frequency--; // Decrement frequency cause launch also increments it
|
app.frequency--; // Decrement frequency cause launch also increments it
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue