Implemented the ability to specify the terminal to launch btop with.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
import options from "options";
|
||||||
|
|
||||||
|
const { terminal } = options;
|
||||||
|
|
||||||
const Stats = () => {
|
const Stats = () => {
|
||||||
const divide = ([total, free]) => free / total;
|
const divide = ([total, free]) => free / total;
|
||||||
|
|
||||||
@@ -131,21 +135,25 @@ const Stats = () => {
|
|||||||
vpack: "center",
|
vpack: "center",
|
||||||
children: [
|
children: [
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
label: "",
|
label: "",
|
||||||
}),
|
}),
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
child: Widget.LevelBar({
|
child: Widget.LevelBar({
|
||||||
class_name: "stats-bar",
|
class_name: "stats-bar",
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -173,21 +181,25 @@ const Stats = () => {
|
|||||||
hexpand: true,
|
hexpand: true,
|
||||||
children: [
|
children: [
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
label: "",
|
label: "",
|
||||||
}),
|
}),
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
child: Widget.LevelBar({
|
child: Widget.LevelBar({
|
||||||
class_name: "stats-bar",
|
class_name: "stats-bar",
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -213,21 +225,25 @@ const Stats = () => {
|
|||||||
vpack: "center",
|
vpack: "center",
|
||||||
children: [
|
children: [
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
label: "",
|
label: "",
|
||||||
}),
|
}),
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
child: Widget.LevelBar({
|
child: Widget.LevelBar({
|
||||||
class_name: "stats-bar",
|
class_name: "stats-bar",
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -253,28 +269,32 @@ const Stats = () => {
|
|||||||
vpack: "center",
|
vpack: "center",
|
||||||
children: [
|
children: [
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
label: "",
|
label: "",
|
||||||
}),
|
}),
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
on_primary_click: () => {
|
on_primary_click: terminal.bind("value").as(term => {
|
||||||
|
return () => {
|
||||||
App.closeWindow("dashboardmenu");
|
App.closeWindow("dashboardmenu");
|
||||||
Utils.execAsync('bash -c "kitty -e btop"').catch(
|
Utils.execAsync(`bash -c "${term} -e btop"`).catch(
|
||||||
(err) => `Failed to open btop: ${err}`,
|
(err) => `Failed to open btop: ${err}`,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
}),
|
||||||
child: Widget.LevelBar({
|
child: Widget.LevelBar({
|
||||||
class_name: "stats-bar",
|
class_name: "stats-bar",
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
vpack: "center",
|
vpack: "center",
|
||||||
value: storage.bind("value").as((v) => v.percentage),
|
value: storage.bind("value").as((v) => v.percentage),
|
||||||
}),
|
}),
|
||||||
}),
|
})
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export const BarGeneral = () => {
|
|||||||
Option({ opt: options.theme.font.name, title: 'Font', type: 'font' }),
|
Option({ opt: options.theme.font.name, title: 'Font', type: 'font' }),
|
||||||
Option({ opt: options.theme.font.size, title: 'Font Size', type: 'string' }),
|
Option({ opt: options.theme.font.size, title: 'Font Size', type: 'string' }),
|
||||||
Option({ opt: options.theme.font.weight, title: 'Font Weight', subtitle: "100, 200, 300, etc.", type: 'number' }),
|
Option({ opt: options.theme.font.weight, title: 'Font Weight', subtitle: "100, 200, 300, etc.", type: 'number' }),
|
||||||
|
Option({ opt: options.terminal, title: 'Terminal', subtitle: "Tools such as 'btop' will open in this terminal", type: 'string' }),
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user