Giter VIP home page Giter VIP logo

Comments (3)

sprak3000 avatar sprak3000 commented on June 6, 2024

@donzee529

Have you read through the Writing plugins guide? Start there to get a general overview of how plugin development works.

from xbar-plugins.

donzee529 avatar donzee529 commented on June 6, 2024

I tried but it wasnt working

#!/bin/bash

# Specify the path to the Pictures folder
pictures_folder="~/Pictures"

# Specify the name of the app to toggle
app_name="MyApp"

# Check if the app is running
if pgrep -xq "$app_name"; then
    # App is running, so we'll stop it
    killall "$app_name"
    echo "Start $app_name | shell=/usr/bin/open | param1=-a | param2=$app_name | emojize=false"
    echo "----"
    echo "Pictures Folder | href=file://$pictures_folder | image=base64_icon_data_here"
else
    # App is not running, so we'll start it
    open -a "$app_name"
    echo "Stop $app_name | shell=pkill | param1=-x | param2=$app_name | emojize=false"
    echo "----"
    echo "Pictures Folder | href=file://$pictures_folder | image=base64_icon_data_here"
fi

from xbar-plugins.

sprak3000 avatar sprak3000 commented on June 6, 2024

@donzee529

One thing that jumps out is having too many hyphens for the menu separator.

This

    echo "----"

should be

    echo "---"

Three hyphens... That will at least get the plugin to have your Pictures Folder menu item show up. If I run your plugin and substitute for MyApp, the plugin loads up the application at startup and then shows the Stop <app name> in the menu bar. However, I don't think the menu bar item does anything beyond opening up the menu when you click on it. If you want an action to stop the application, that would need to go in the menu after the echo "---" line, as you have the Pictures Folder link.

from xbar-plugins.

Related Issues (20)

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.