Open an applet from cli

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
daffa

Open an applet from cli

Post by daffa »

Is it possible to open an applet (like you usually do with clicking it) from cli? Does there is any command or script to do it? I'm running Linux Mint 18.3 64 bit with Cinnamon 3.6.7 (Gtk 3.18.9-1ubuntu3.3)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Open an applet from cli

Post by xenopeek »

Not that I know. The Cinnamon panel doesn't have a command line interface. There's a tool called xdotool with which you can fake keyboard or mouse input which you could use to open the applet by programming what you'd do normally.
Image
daffa

Re: Open an applet from cli

Post by daffa »

xenopeek wrote: Mon Apr 02, 2018 2:47 am Not that I know. The Cinnamon panel doesn't have a command line interface. There's a tool called xdotool with which you can fake keyboard or mouse input which you could use to open the applet by programming what you'd do normally.
That's not really what i'm looking for, but rather a smart trick (or workaround). I'll give it a shot anyway. A real command command would be nice though. Could this possible through extension?
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Open an applet from cli

Post by Cosmo. »

I don't think, that any of the spices (applets, desklets, extensions) have an API for that.
daffa

Re: Open an applet from cli

Post by daffa »

Cosmo. wrote: Thu Apr 05, 2018 9:38 am I don't think, that any of the spices (applets, desklets, extensions) have an API for that.
Well, that leave me with that workaround then. Anyway, i was going to make a script that will open sound applet when user press volume up/down on their keyboard and there is any audio/video playing, then close the applet after a few second. Pretty much like in windows 10.
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Open an applet from cli

Post by xenopeek »

Depending on how comfortable you're with Javascript programming, it may be easier to just take the existing sound applet and edit its code to work as you want.
Image
daffa

Re: Open an applet from cli

Post by daffa »

Well, i code in javascript mostly. Does it possible to make an applet that able to react with keyboard? Could you give me a link to a wiki or tutorial?
User avatar
xenopeek
Level 25
Level 25
Posts: 29507
Joined: Wed Jul 06, 2011 3:58 am

Re: Open an applet from cli

Post by xenopeek »

New developer documentation is being worked on I think. For now you can check the extension system links here: http://projects.linuxmint.com/referenc ... index.html. All the applets are open source and hosted in Linux Mint's GitHub repositories. The official applets are on Cinnamon https://github.com/linuxmint/Cinnamon/t ... on/applets. Applets developed by others are on https://github.com/linuxmint/cinnamon-spices-applets. You could look for another applet that does something like you want to do and study the code. (Mind that the links go to development versions, you can of course just install any applets you want to study and then access the code on your own system that way.)
Image
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Open an applet from cli

Post by Cosmo. »

daffa wrote: Thu Apr 05, 2018 11:56 am Anyway, i was going to make a script that will open sound applet when user press volume up/down on their keyboard and there is any audio/video playing, then close the applet after a few second. Pretty much like in windows 10.
Why so complicated in this case? If the user changes the volume via keyboard the sound notification window automatically opens for a few seconds. So I wonder, why you need the applet opened in this case at all?
daffa

Re: Open an applet from cli

Post by daffa »

xenopeek wrote: Fri Apr 06, 2018 4:27 am New developer documentation is being worked on I think. For now you can check the extension system links here: http://projects.linuxmint.com/referenc ... index.html. All the applets are open source and hosted in Linux Mint's GitHub repositories. The official applets are on Cinnamon https://github.com/linuxmint/Cinnamon/t ... on/applets. Applets developed by others are on https://github.com/linuxmint/cinnamon-spices-applets. You could look for another applet that does something like you want to do and study the code. (Mind that the links go to development versions, you can of course just install any applets you want to study and then access the code on your own system that way.)
Neat. Thanks for all your help, i'll begin researching.
daffa

Re: Open an applet from cli

Post by daffa »

Cosmo. wrote: Fri Apr 06, 2018 6:41 am Why so complicated in this case? If the user changes the volume via keyboard the sound notification window automatically opens for a few seconds. So I wonder, why you need the applet opened in this case at all?
Idk, this crazy idea suddenly came up in my mind. And i think it would be cool if you could control applets using keyboard. Btw, sound notification just displaying the volume level, user can't do anything with it. However, if i show the sound applet, user would be able to change the volume through slider and control playing music or video. Like windows 10 do when you change volume through keyboard.
Locked

Return to “Scripts & Bash”