Coder Social home page Coder Social logo

raujonas / executor Goto Github PK

View Code? Open in Web Editor NEW
76.0 2.0 13.0 3.38 MB

Gnome Shell Extension - Execute multiple shell commands periodically with separate intervals and display the output in gnome top bar.

Home Page: https://raujonas.github.io/executor

JavaScript 95.84% Shell 2.57% CSS 1.59%
gnome shell gnome-shell-extensions interval

executor's Introduction

Executor - Gnome Shell Extension

Maintenance GitHub release (latest by date) GitHub Release Date GitHub Repo stars

Execute multiple shell commands periodically with separate intervals and display the output in gnome top bar.

result

Get it on GNOME Extensions

result

Documentation: here

executor's People

Contributors

g-dh avatar kenzoi avatar mkalinski avatar raujonas avatar shemgp avatar snax44 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

executor's Issues

Command execution does not work under nixos

Hey there,

this looks like a really nice plugin. Sadly when I run it under gnome 40 on nixos, I get no errors, but no messages appear anywhere in the status bar no matter what I do. Is this plugin tested and supposed to be working on gnome 40?

Unhandled promise rejection for commands using <executor.markup.true>

Somehow #53 returned.

Jan 06 19:58:38 mk gnome-shell[3098]: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
                                        execCommand@/home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:247:27
                                        handleCurrentQueue@/home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:233:10
                                        handleCurrentQueue/<@/home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:238:22

It looks like it only happens for commands that include the <executor.markup.true> string in output, whether or not any markup is actually used.

EDIT: After further fiddling, it also happens sometimes for commands that don't contain <executor.markup.true>. I can't tell anymore what exactly causes this to happen. But <executor.markup.true> causes it 100% of the time.

Use bash instead of sh

  • Use bin/bash/ instead of bin/sh/ for fixing problems with complex commands executed with sh

The longest Executor command on the right side is always truncated

The bug occurs on Gnome 46. It did not occur on Gnome 45.

This is a very odd bug that's a bit hard to describe.

To reproduce:

  1. Create any command in the right panel of executor settings.
  2. The output from this command will not show in full, unless it outputs just one character. Otherwise, a ... will replace it, or part of it.

image
The ... on the right side is the output from a command echo 'aa'.

The weird stuff starts happening when there are multiple commands.

It the multiple commands produce output of the same length, the last output will be truncated.
Screenshot from 2024-05-19 13-49-59
This is output from two echo 'new command' commands. The last one gets the ....

However, if the command outputs are of differing lengths, the longest will be truncated.
image
Here, there are two echo 'new command' commands, and one echo 'new commandaaaaaaaaaaaa' command. the longest is truncated.

You can also see that the truncation is not dependant on the length of the output itself. No matter how long or short it is, part of it will be cut off.

The truncation also doesn't depend on the position of the Executor panel on the right side of the top bar.

Also, and I don't know if it's related, in the logs there's this getting spammed:

Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack traceof the failed promise:
execCommand@file:///home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:239:22
handleCurrentQueue@file:///home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:223:14
checkQueue@file:///home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:209:18
checkQueue/<@file:///home/mk/.local/share/gnome-shell/extensions/[email protected]/extension.js:213:26
@resource:///org/gnome/shell/ui/init.js:21:20

But it doesn't depend on the truncated commands being shown or not.

Multimonitor executor?

Multimonitor extension is really helpful to have several status areas available. I don't see any way to make use of that with executor unfortunately, it works on one monitor only. Any idea how to make use of more than one of them?

[Question] Staked / Multi-Line layout

Hello!

For outputs that are wide but not too tall, would there be a way to “stack” the outputs?

I tried inserting a new line (\n) or line break (<br />) in the command output, but they are printed as text.

For example, the two lines below take quite a bit of horizontal space, and it would be nice if they could be printed on two lines
image
(i.e. line 1: weather / line 2: speedtest)

Thanks for this neat piece of software 👍

Show state of SteelSeries Arctis 7 headset

Hi,

thanks for the extension. I'd like to share my config for a SteelSeries Arctis 7 headset, which shows either 'Off' or "battery | chat-mix-dial level'. Since, to my best knowledge, there is no proper integration for this headset into Gnome, I used the HeadsetControl (https://github.com/Sapd/HeadsetControl) tool from @Sapd which works without issues.

Headset On:
image

Headset On (battery critical):
image

Headset Off:
image

The command is likt his:

echo "" | awk '{if (battery > 0) { printf icon" "; printf " "battery"%"; if(battery < 10) { printf "<executor.css.red>"} print " | "vcm} else { print icon, "Off<executor.css.gray>"} }' vcm="`headsetcontrol -c -m`" battery="`headsetcontrol -b -c`" icon="`echo -e '\U1f3a7'`"

And finally this is the custom.css I used:

.red {
    color: red;
}

.white {
    color: white;
}

.gray {
    color: gray;
}

Maybe somebody else finds this useful.

Cheers

View does not update when checked command returns no output

I am using executor to run a script that in some cases returns output, and in some cases just exits with status code 0. If the scripts output changes from a state in which it did give output to a state in which it just exits without output, executor does not update it's view.

As a workaround I made my script print an empty string using echo "". This seems to resolve the problem.

Using the latest version from Gnome Extensions (labeled 'version 1') on Ubuntu 20.04 on Gnome 3.36.3

Don`t work in Gnome 46

Hello, as you may have noticed, it has stopped working in Gnome 46, thank you very much, we hope, as in every damn Gnome update, for your effort and we greatly appreciate it.

Translations

The extensions now supports translations, PRs for new languages or updates are very welcome! 😊

Currently supported:
English -> up to date ✔️
French -> up to date ✔️
German -> up to date ✔️

Support launching commands

It would be really useful to be able to be able to run a custom command when clicking on one of the command outputs in the toolbar. For example, I have a script which shows if my office heater is on or off, if I could click the 'heater is on' text to launch a custom command then I could toggle it on/off straight from the shell.

From what I see it should be fairly easy to implement - another column in the extension prefs to declare the command to run and an onclick action (or whatever gnome-shell uses) for the item in the toolbar

Use case: Beep Timer

First: Thank you Jonas. So practical and flexible.

If you choose to implement #60 first, I'm willing to provide a PR for this use case.

I'm using this in place of (discontinued) Beep Timer extension for short (20-30 sec) cycle of "Stay on track" alerts (not replacing, but in addition to Pomodoro).

  1. Install mplayer, or any other player that can be started from shell.

  2. Get the sounds you like. For example, download from https://github.com/gnome-pomodoro/gnome-pomodoro/tree/master/data/sounds or clone that repo:

mkdir GIT
cd GIT
git clone https://github.com/gnome-pomodoro/gnome-pomodoro
  1. Then invoke it in Executor, for example:
    mplayer -ao pulse -nolirc -volume 60 GIT/gnome-pomodoro/data/sounds/bell.ogg > /dev/null.

If you like fine grain sound volume control, use -ao pulse. That applies the given volume, multiplied (divided) by the overall System Volume (as shown in the standard GNOME Settings application).

To the contrary, -ao alsa takes the given volume, and resets the System Volume to that value!

Of course, if you use it at the same time as Pomodoro extension, you may want them to use different sounds.

gettext can only be called from extensions

Thank you for Executor. I confirm it runs on GNOME 45 (on current Manjaro x64 = stable Arch Linux).

Only once (today) I've received the below error. It was after I clicked at the Executor's icon on my panel. I couldn't reproduce it since then.

Error: gettext can only be called from extensions

Stack trace:
  #lookupExtension@resource:///org/gnome/Shell/Extensions/js/extensions/sharedInternals.js:219:19
  #gettext@resource:///org/gnome/Shell/Extensions/js/extensions/sharedInternals.js:224:48
  getPreferencesWidget@file:///home/pkehl/.local/share/gnome-shell/extensions/[email protected]/prefs.js:15:16
  fillPreferencesWindow@resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js:36:29
  _loadPrefs@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:36:18
  async*_init@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:21:14
  ExtensionPrefsDialog@resource:///org/gnome/Shell/Extensions/js/extensionPrefsDialog.js:12:4
  OpenExtensionPrefsAsync@resource:///org/gnome/Shell/Extensions/js/extensionsService.js:139:33
  async*_handleMethodCall@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:373:35
  _wrapJSObject/<@resource:///org/gnome/gjs/modules/core/overrides/Gio.js:408:34
  _init/GLib.MainLoop.prototype.runAsync/</<@resource:///org/gnome/gjs/modules/core/overrides/GLib.js:266:34

Installed from https://extensions.gnome.org/extension/2932/executor. GNOME reports the extension version as 25.

Please advise on any commands/steps for me to take, if needed.

signal: instance has no handler with id ...

When disabling Executor:

../../../gobject/gsignal.c:2736: instance '0x558f1fce2c30' has no handler with id '241808'
../../../gobject/gsignal.c:2736: instance '0x558f1fce2c30' has no handler with id '241848'
../../../gobject/gsignal.c:2736: instance '0x558f1fce2c30' has no handler with id '241863'
Executor stopped

Improve row selection in settings

Currently a row is only selected if one clicks the small gap between command entry and interval -> it should be selected if one clicks on one of these to elements

Prompt user before closing without saving

When I opened the configuration window for Executor, I modified, added and removed commands. I then clicked the "x" button to close the window. To my surprise, the configuration did not take effect.

This is what I expected to happen. I expected one of these two outcomes:

  • I expected all changes made in the configuration window to apply immediately, the way that most settings work in GNOME's Settings app
  • OR, I expected to be prompted when exiting the configuration window without saving, asking whether I wanted to "save changes", "discard changes", or "cancel" exiting. This would be similar to gedit.

I also expected there to be one save button for the entire configuration, rather than having to save each configuration ("right", "center", "left") separately.

Add popup menu or tooltip

Hello! It will be excellent idea to add tooltip (over cursor) or popup menu with some info from script.
For example: I check Server status. And If it online, main text on toolbar is "ON" and on popup / tooltip - users online list.

p.s. By popup i mean program menu
Снимок экрана от 2021-05-31 16-11-15

p.s.2 - Sorry for my English

Add option to disable settings window popup when clicking top bar

Using executor in combination with programs that have frequently-clicked elements near Gnome's top bar causes annoyance when misclicking on executor output, which opens the extension's settings window.

An example: tabs in a web browser with no title bar.
Half my top bar is executor output, so this happens often enough that it's a nuisance.

BTW, this extension is great, thank you for making/maintaining it.

README.md for "documentation" branch

Hi Jonas,

I'd be happy to create a PR for "documentation", but I don't know ho wit's generated, or what the formatting/generator technology is.

Please provide README.md with steps to re-generarate, and with basic links about how it's written or what it uses, so that people can contribute PR's.

Unhandled promise rejection

Hi,
thank you for this very useful extension!

I have one little complain, which might be simple to solve: My systemd user log shows for each command executor executes the following message...

Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise:
    setOutput@/home/simon/.local/share/gnome-shell/extensions/[email protected]/extension.js:333:25
    callback@/home/simon/.local/share/gnome-shell/extensions/[email protected]/extension.js:323:14
    execCommand/</<@/home/simon/.local/share/gnome-shell/extensions/[email protected]/extension.js:272:26

Executor itself works quite well but as I fire off multiple commands every couple of minutes my systemd log is littered by this message.
Hence it would be very helpful if you could insert some kind of error handling in your code!

Thanks in advance!

Simon

Feature request: click to refresh

I have a command that I have set to run every 600 seconds. It would be nice if I could click the widget where the output is displayed in order to force the command to be re-run.

Right now, I click on the widget, the settings open, I disable the widget and then re-enable it. That's how I force a refresh currently.

Colours?

Any chances to change font colour of parts of the output? It would be very helpful to spot some anomalies.

Updated french translation done

french.zip
It's my first try to create a french translation using poedit.

I modified the main fr.po (using example.txt) and I produced the corresponding new fr.mo. I had a message about unavailable current directory probably because I downloaded main extension git repository as a zip file and worked on the unzip content.

I renamed the new fr.mo produced file as [email protected] and I copied it in my ~/.local/share/gnome-shell/extensions/[email protected]/locale/fr/LC_MESSAGES directory.

It works perfectly.

I enclosed the new fr.po and the new fr.mo renamed to [email protected]

Add a dynamic script launcher

Hi,
First of all thank a lot for your work, this extension is awesome.

My goal was a little bit different, I wanted to show alternatively some infos (ip, cpu load, ram etc...)
So I use your extension to do that and keep profit of the other features.

  1. Make a scripts directory

As explain here for using custom.css, it's better to put your scripts in ~/.config/executor...
This way your custom css will NOT be overwritten by extension updates

mkdir ~/.config/[email protected]/scripts
  1. Put your scripts in the scripts directory (they must be executable and have a shebang)
    example:
#! /bin/bash

ping -W 1 -4 -c 1 ifconfig.me > /dev/null 2>&1

if [[ "$?" == "0" ]]; then
  WAN_IP=$(curl -s ifconfig.me)
else
  WAN_IP="Not connected"
fi

# Auto detect lan interface based on the default route.
LAN_INTERFACE=$(ip route show default | awk '/default/ {print $5}')

# IPV4 Address
LAN_IP=$(ip a show dev $LAN_INTERFACE | grep --color=none inet | grep -v inet6 | awk '{ print $2; }' )

echo  "LanIP: $LAN_IP     WanIP: $WAN_IP" | tr '\n' ' '
  1. make a main script to call scripts alternatively

~/.config/[email protected]/executor.sh

#!/usr/bin/env bash

WORKDIR=$(dirname $0)
INDEX_FILE="$WORKDIR/executor.index"
SCRIPTS_DIR="$WORKDIR/scripts"

for e in $(ls $SCRIPTS_DIR); do
  if [ -x "$SCRIPTS_DIR/$e" ]; then 
    SCRIPTS_LIST=("${SCRIPTS_LIST[@]}" "$e")


  fi
done


if [[ -f $INDEX_FILE ]]; then
  source $INDEX_FILE
  $SCRIPTS_DIR/${SCRIPTS_LIST[$INDEX]}
  INDEX=$(( $INDEX + 1 ))

  if [[ $INDEX = ${#SCRIPTS_LIST[@]} ]]; 
    then INDEX=0
  fi
  echo "INDEX=$INDEX" > $INDEX_FILE
else
  echo "INDEX=0" > $INDEX_FILE
fi
  1. Call ~/.config/[email protected]/executor.sh from executor config window.

It's maybe not the optimal or beautiful way to do that but it work's. ;-)
I just wanted to share if someone need the same feature.

Edit:

  1. Put everything in ~/.config/executor... instead of ~/.local/share/gnome-shell/extensions/executor ...
  2. ./ instead of bash to be able to execute other languages

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.