more config option for apps

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