uebersicht icon indicating copy to clipboard operation
uebersicht copied to clipboard

Manual refreshing of widgets instead of automatic

Open aklsh opened this issue 4 years ago • 2 comments

@felixhageloh I have been using this app for about a month or so. I've liked all but one thing about it.

I use the app with only 2 widgets - a network widget and a todo list widget. The problem is, since they refresh very rarely, I would prefer having a manual refresh for them instead of an automatic one, as I have observed that my battery drains more quickly these days. Even clicking on the battery icon on the menu bar tells that the app is using significant energy.

Can you please introduce a feature such that the user can have manual refresh for all widgets? Or if there is already one such feature, I am not aware of it. Can you please tell me how to do it in that case?

aklsh avatar Mar 19 '20 12:03 aklsh

Was looking for a similar solution and added an onclick event that just touches the jsx file. appears to work well for manual refreshing, however haven't looked into energy usage

import { React, run } from 'uebersicht';
const widgetFilePath = './widget_folder/Widget.jsx';

function touchFile(path) {
    run(`touch ${path}`);
}

// in render fn
export const render = (props) => {
  // ...
  return (
    // ...
    <span className="refresh icon" onClick={e => touchFile(widgetFilePath)} />
  );
}

majman avatar Jun 26 '20 16:06 majman

I did use:

export const render = (props, dispatch) => {
  const { some, other } = props;
  const updateIP = () =>
    run(command).then((output) => dispatch({ type: 'OUTPUT_UPDATED', output }));
  return (<div className={style} onClick={updateIP}>{some}{other}</div>)
}

When the user clicks the element in my widget, it will call updateIP, which will run the command in my widget and will dispatch the new output.

0x3333 avatar Apr 20 '23 18:04 0x3333