more config option for apps

This commit is contained in:
end-4
2024-03-30 21:53:20 +07:00
parent e95d2e88d6
commit 545057fd9f
4 changed files with 24 additions and 18 deletions
@@ -20,7 +20,11 @@ let configOptions = {
'keyboardUseFlag': false, // Use flag emoji instead of abbreviation letters
},
'apps': {
'bluetooth': "blueberry",
'imageViewer': "loupe",
'network': "XDG_CURRENT_DESKTOP=\"gnome\" gnome-control-center wifi",
'settings': "XDG_CURRENT_DESKTOP=\"gnome\" gnome-control-center wifi",
'taskManager': "gnome-system-monitor",
'terminal': "foot", // This is only for shell actions
},
'battery': {
+17 -14
View File
@@ -59,20 +59,23 @@ const BarResource = (name, icon, command, circprogClassName = 'bar-batt-circprog
const resourceLabel = Label({
className: `txt-smallie ${textClassName}`,
});
const widget = Box({
className: `spacing-h-4 ${textClassName}`,
children: [
resourceProgress,
resourceLabel,
],
setup: (self) => self
.poll(5000, () => execAsync(['bash', '-c', command])
.then((output) => {
resourceCircProg.css = `font-size: ${Number(output)}px;`;
resourceLabel.label = `${Math.round(Number(output))}%`;
widget.tooltipText = `${name}: ${Math.round(Number(output))}%`;
}).catch(print))
,
const widget = Button({
onClicked: () => Utils.execAsync(['bash', '-c', `${userOptions.apps.taskManager}`]).catch(print),
child: Box({
className: `spacing-h-4 ${textClassName}`,
children: [
resourceProgress,
resourceLabel,
],
setup: (self) => self
.poll(5000, () => execAsync(['bash', '-c', command])
.then((output) => {
resourceCircProg.css = `font-size: ${Number(output)}px;`;
resourceLabel.label = `${Math.round(Number(output))}%`;
widget.tooltipText = `${name}: ${Math.round(Number(output))}%`;
}).catch(print))
,
})
});
return widget;
}
@@ -24,7 +24,6 @@ async function getImageViewerApp(preferredApp) {
}
const IMAGE_REVEAL_DELAY = 13; // Some wait for inits n other weird stuff
const IMAGE_VIEWER_APP = getImageViewerApp(userOptions.apps.imageViewer); // Gnome's image viewer cuz very comfortable zooming
const USER_CACHE_DIR = GLib.get_user_cache_dir();
// Create cache folder and clear pics from previous session
@@ -15,7 +15,7 @@ export const ToggleIconWifi = (props = {}) => Widget.Button({
tooltipText: 'Wifi | Right-click to configure',
onClicked: () => Network.toggleWifi(),
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', 'XDG_CURRENT_DESKTOP="gnome" gnome-control-center wifi', '&']);
execAsync(['bash', '-c', `${userOptions.apps.network}`, '&']);
App.closeWindow('sideright');
},
child: NetworkIndicator(),
@@ -40,7 +40,7 @@ export const ToggleIconBluetooth = (props = {}) => Widget.Button({
exec('rfkill unblock bluetooth');
},
onSecondaryClickRelease: () => {
execAsync(['bash', '-c', 'blueberry &']);
execAsync(['bash', '-c', `${userOptions.apps.bluetooth}`]).catch(print);
App.closeWindow('sideright');
},
child: BluetoothIndicator(),
@@ -213,7 +213,7 @@ export const ModuleSettingsIcon = (props = {}) => Widget.Button({
className: 'txt-small sidebar-iconbutton',
tooltipText: 'Open Settings',
onClicked: () => {
execAsync(['bash', '-c', 'XDG_CURRENT_DESKTOP="gnome" gnome-control-center', '&']);
execAsync(['bash', '-c', `${userOptions.apps.settings}`, '&']);
App.toggleWindow('sideright');
},
child: MaterialIcon('settings', 'norm'),