[Solved] Create a dmenu custom menu

Hi,
I was wondering if it is possible to create a custom dmenu's menu.
For example I would like to have a special 'session' menu with logout, shutdown and reboot actions, with these actions bound to special commands like 'sudo shutdown -h now'.
Is this possible? How?
Thank you
Last edited by rent0n (2010-04-25 19:25:37)

brisbin33 wrote:
I've been using this one for a while:
#!/bin/bash
# a simple logout dialog
kill_apps() {
while read -r app; do
wmctrl -i -c "$app"
done < <(wmctrl -l | awk '{print $1}')
choice_by_zenity() {
choice=$(zenity --title="Logout $HOSTNAME" \
--text="Logout $HOSTNAME:" \
--list --radiolist \
--hide-column=3 --print-column=3 \
--column='' --column='' --column='' \
TRUE Logout 0 FALSE Reboot 1 FALSE Shutdown 2)
choice_by_dmenu() {
if [[ -f "$HOME/.dmenurc" ]]; then
. "$HOME/.dmenurc"
else
DMENU='dmenu -i'
fi
choice=$(echo -e "0: Logout\n1: Shutdown\n2: Reboot" | $DMENU | cut -d ':' -f 1)
[[ -z "$DISPLAY" ]] && exit 1
#choice_by_zenity
choice_by_dmenu
[[ -z "$choice" ]] && exit 1
# gracefully close all open apps
kill_apps
# execute the choice in background
case "$choice" in
0) kill $(pgrep X) & ;;
1) sudo shutdown -r now & ;;
2) sudo shutdown -h now & ;;
esac
Very nice!
I'm trying to make a very basic version of it, but I am probabling missing something obvious as I am only able to logout but I can't perform other actions: could you take a look at it and tell me what's wrong?
#!/bin/bash
# a simple dmenu session script
# by brisbin33
DMENU='dmenu -i -b -fn -xos4-terminus-medium-r-*--12-*-*-*-*-*-iso10646-1 -nb #000000 -nf #999999 -sb #000000 -sf #31658C'
choice=$(echo -e "logout\n shutdown\n reboot\n suspend\n hibernate\n" | $DMENU | cut -f 1)
case "$choice" in
logout) i3-msg exit ;;
shutdown) sudo shutdown -h now ;;
reboot) sudo shutdown -r now ;;
suspend) sudo pm-suspend ;;
hibernate) sudo pm-hibernate ;;
esac
Thanks!
EDIT: fixed!
#!/bin/bash
# a simple dmenu session script
DMENU='dmenu -i -b -fn -xos4-terminus-medium-r-*--12-*-*-*-*-*-iso10646-1 -nb #000000 -nf #999999 -sb #000000 -sf #31658C'
choice=$(echo -e "logout\nshutdown\nreboot\nsuspend\nhibernate" | $DMENU)
case "$choice" in
logout) i3-msg exit & ;;
shutdown) sudo shutdown -h now & ;;
reboot) sudo shutdown -r now & ;;
suspend) sudo pm-suspend & ;;
hibernate) sudo pm-hibernate & ;;
esac
Thank you brisbin, this script is very cool!
Last edited by rent0n (2010-04-25 19:29:33)

Similar Messages

  • How to create a PJC custom menu in forms

    Hello
    I want to make my own menu using Java and replace the default forms menu with it.
    lets say i'll make in java a JMenubar with menus inside it
    how to place it as a menu of my form ?
    is it possible ?
    10x

    ok i made a Jmenubar with some menus and i placed it into a bean area and it works, BUT :
    when the bean area is in the bottom of the canvas the menus are showing just fine, but when i place the bean area in the top of the canvas the menus dont show (the popup) when i click the menubar. why is that ?
    i'm not forms developer i saw forms 2 days ago for the first time, i'm java developer and the task is given to me by my boss - the aim of it is to make a butiful looking menu that is DYNAMIC , i have no idea if a forms meny can be made dynamic, but thats my boss i cant convince him that his idea is bad :)) moreover i think i'm realy close.

  • How Tou2026 Create Custom Menu within BPC NW - OPENFILE issue

    Hi Guys,
    I built a custom menu in BPC 7.5 using the step-by-step procedure available in u201CHow Tou2026 Create Custom Menu within BPC NWu201D. It uses the OPENFILE option with EvMnu to open dynamic templates describing this limit:
    The OPENFILE option within the NW Version can only open workbooks from cached directories in local PC. Therefore, it is a best practice to ensure that OPENFILE only refers to templates that are available as dynamic templates that are cached (updated template version) on all client PCs that are using the EvMnu based workbook.
    At the moment Iu2019m working with more than 40 users, which surely will increase. So, I have to find others solutions or automate the local saving:
    - Do I have to ask our users to save locally all dynamic templates?
    - Do you know if I can save automatically (not manually one-by-one) all dynamic templates in all client PCs allowing the OPENFILE option to work correctly?
    - Do you know if there are others solutions, like commands or macro (not BPF), to open dynamic templates from custom menu without local saving?
    Thanks for your answers.

    Hi Nilanjan,
    Thank you for your quick answer. I need to open a single dynamic report for each link, not the complete report folder.
    OPENWEBFOLDER works correctly, but unluckily it doesnu2019t cover my issue.
    OPENWEBFILE could be the solution, but it doesnu2019t work. I used this syntax: 
    =EVMNU("OPENWEBFILE"," optional text ","REPORTS\TestReport.xlt")
    Clicking it, the system shows this message u201COPENWEBFILE: macro not supportedu201D.
    Do you know if OPENWEBFILE works correctly in BPC 7.5 NW?
    Thanks for your support.
    Edited by: D-Mark on Sep 16, 2010 4:21 PM

  • Create custom menu and add menu elements to it

    hi,
    i used the sample javacript "ScriptMenuAction.jsx" to create a custom menu.
    that script has this command: var mySampleScriptAction = app.scriptMenuActions.add("Display Message");
    which adds submenu called Display message.
    my question is how to add a submenu to "Display message" submenu...  i mean when we click on "File" menu, it shows "New" as the 1st element..if we click on "New" it shows another window giving option to create a new document, book or library....how to create such structure for my custom menu using javascript?
    thanks

    himanshuXRX wrote:
    that script has this command: var mySampleScriptAction = app.scriptMenuActions.add("Display Message");
    which adds submenu called Display message.
    The command you quoted is not the part of the code that adds a Submenu. This adds a ScriptMenuAction. The key is that actions are decoupled from menu/submenus/menuitem stuff. Take a look at the menu/submenu hierarchy to add the structure you need. This page may help you:
    http://www.indiscripts.com/post/2010/02/how-to-create-your-own-indesign-menus
    @+
    Marc

  • Creating a custom menu on a canvas

    Is there anyway that I can dispaly a custom menu on canvas?
    Thank you.

    Tony, the oracle toolbar is fine. Let me describe what I am trying to do. Currently
    we are not doing single sign on yet.
    I have a login form where a user(s) type in his username & password.
    I now have a bunch of forms my user(s) can choose from depending on there job function. I was thinking if I had some sort of a menuing system my user(s) would
    be able to pick what form they need. In a previous post I said that I got the pop menu to work and I asked if there is a way to control where the popup menu is displayed(x,y) and is there a way to make it look like it is a separate form or take up the whole window? Could you suggest another way to do this?
    Thanks

  • Hide custom menu's

    When adding menu's to the 'main menu' there doesn't seem to be a way to hide them from certain users like we can do with the standard menu's.
    The new custom menu does show up in the 'settings' from of the main menu and when unchecking certain sub menu's the do disappear but this isn't saved to the database. Since on next login the menu's are visible again.
    Is there any way to force this to be saved or am I going to have to make my own form to save / apply these settings?

    Hello
    Yes, you have right.  To do in this case:
    1. Create Additional Authoritzation . Itself it will not solve the problem
    2. When you creating the menu, You can Query the Additional Authorization, and make Menu Item Disabled/Enabled depending from the authorization.
    Use the UserPermission object to query the Users Authorization
    3. By Disableing a menuitem -> will hidden from the Main Menu Panel.
    Use the MenuItem.Enabled property to enable/disable the menuitem
    Regards,
    János

  • Getting error while creating subsite using custom template in sharepoint2013

    Hi,
    I am getting the following error while creating subsite using custom template in sharpoint2013. even publish features are enabled.
    Please suggest me on this.
    Thanks in advance.

    You need to enable the PerformancePoint Service Site Collection Features(PPSMonDatasourceCtype)
    on the target site collection. go to site action > site settings> site collections features > and enable it and now try again.
    Similar case: http://imughal.wordpress.com/2012/09/20/dependency-feature-ppsmondatasourcectype-id-05891451-f0c4-4d4e-81b1-0dabd840bad4-for-feature-bicenterdataconnections-id-3d8210e9-1e89-4f12-98ef-643995339ed4-is-not-activated-at-this-scop/
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • Weird custom menu behavior in 8.2

    I'm in charge of upgrading a large project from LV 7.1 to 8.2 and I ran into several problems but was able to resolve them except 2 major ones (not including the crashing tables and indices in self-indexing while loops).
    1) Our custom menu now seems to badly lag when trying to open it. Takes a good 2-3 seconds for any items to show up when the application is running and this behavior continues UNTIL i switch to the block diagram and put in the password for our application (to access the code). This definitely seems like a bug and I wasn't able to find any similar posts. Is this a known issue? Why does it happen?
    2)Badly lagging .VIT files. We have about 7 custom display .vit subvis which get called as clones by the application. They're not marked as re-entrant and I know 8.x changed the pass-by-value to pass-by-reference handling of clones. Is this the case? Why are my .vit now running twice as slow as in 7.1 on the same computer?
    Altenbach mentioned overlapping elements on the FP of the .vit's in another post, but could someone clear this up for me please? Does slightly overlapping cursor display on a wavegraph count? Or is this when you have a completely different FP control right on top of another control? Any help is greatly appreciated.Message Edited by romulus on 01-24-2007 08:27 AM
    Message Edited by romulus on 01-24-2007 08:31 AM

    Hey romulus,
                  I am still not fully understanding the best way to try and reproduce your issue.  If I were to create a new VI with a custom runtime menu in 7.1, then lock the block diagram with a password, and then open this VI in 8.20, should it display this behavior?  I will continue trying to reproduce this on my machine, but have been unable to thus far.  If you can provide a VI that replicates this problem, I would be happy to talk with R&D about it and see what is happening to cause the issue.  Thanks!!
    Brian B
    Field Sales Engineer
    Tennessee/Southern Kentucky
    National Instruments

  • How to use standard VS commands in custom menu (vsct)

    Hi,
    I have a .vsct file which defines a custom menu. I want to add some default Visual Studio commands to this menu as well. I already managed to add some default commands such as copy / paste:
    <UsedCommands>
    <UsedCommand guid="guidVSStd97" id="cmdidCopy"/>
    </UsedCommands>
    <CommandPlacements>
    <CommandPlacement guid="guidVSStd97" id="cmdidCopy" priority="0x0100">
    <Parent guid="guidMyMenuCommands" id="grpMyMenu"/>
    </CommandPlacement>
    </CommandPlacements>
    When I do this, the "Copy" command shows up in my custom menu, with default Icon, text and shortcut - just as it should be. However, this does not work for all commands. To be precise, when I want to add the following commands...
    <UsedCommand guid="guidVSStd2K" id="ECMD_FORMATDOCUMENT"/>
    <UsedCommand guid="guidVSStd2K" id="ECMD_COMMENT_BLOCK"/>
    <UsedCommand guid="guidVSStd2K" id="ECMD_UNCOMMENT_BLOCK"/>
    ...nothing happens - no entry is added to my custom menu. How can I include the above default commands in a custom menu?
    Thanks,
    Max

    I just found out that the above commands are there after all, but they are invisible until a source code file is opened. I expected them to be grayed out instead of being totally invisible.
    Nevertheless, there are some commands that cannot be "instantiated" with the CommandPlacement tag. Instead, one needs to create a button for the respective command to show up in the menu. The following code shows an example:
    <UsedCommands>
    <UsedCommand guid="guidVSStd97" id="cmdidGotoDefn" />
    </UsedCommands>
    <Commands>
    <Buttons>
    <Button guid="guidVSStd97" id="cmdidGotoDefn" priority="0x0400">
    <Parent guid="guidMyMenuCommands" id="grpMyMenu" />
    <Strings>
    <ButtonText></ButtonText>
    </Strings>
    </Button>
    </Buttons>
    </Commands>

  • How to add custom menu options in myaccounts module?

    Hi experts,
    To implement this, I have found myaccount.xml file in UI of myaccounts module. In this file, I found only menu headings but not menu options. Can anyone explain where data of menu options were populated from and how can I add my custom menu options? I also have tried to delete the menu heading but there was no effect. Please help!! I'm on WEC 1.0.
    Regards,
    Daro

    Hi Daro,
    the path to the billing module is "sap.com/wec/ecom/mc/billing". But nevertheless
    1.  you need only to enhance in your current modul the metadata.xml file with the link to your own myaccount.xml which you can create.
    2. and then you can define within the new file the menu options you need.
    3. the last step is to update your shop configuration with the new menu options.
    Best regards,
    Nico

  • Can I take a frame from my project and use it as a custom menu background with CS4 and its Encore

    My project is edited in CS4.
    I moved it to Encore CS4.
    I don't want to use any of the supplied menu templates in CS4 Encore.
    I was hoping CS4 would be all I needed to create custom menus using scenes from my project.
    My question is: Can I take a frame from my project and use it as a custom menu background with CS4 and its built in Encore or do I need some other element from the Adobe catalog to make these custom chapter menus and sub-menus?
    Thanks Jim

    OK, I'm back. Here are my steps for creating Custom Menus with PS, En and PrPro:
    In PrPro, move the CTI (Current Time Indicator) to the desired Frame. Check Frames on either side, with the Program Monitor’s Magnification to 100%, or maybe even 200% (you’ll need to scroll, but get a really clear picture). You want the clearest Frame in that area. With AME, in CS4, you’ll want to Export that Frame as .TIFF, or .BMP. I use .TIFF for this.
    Now, for a caveat. When you Import this Exported Frame into Photoshop, be sure to check the specs., especially the PAR. You may have to use Image>PAR to adjust this to match your Project’s specs. Or, all might be perfect - just check this out.
    Now, at this point, I choose the Library Menu, Blank, so that everything is setup. One can create the Menu from scratch, but careful attention needs to be paid to the exact naming conventions. At the very least, unless you’ve done this dozens of times before, use that Blank Menu, or similar as a guide, so you get things done, as they must be done.
    Using that Blank Menu, just drag the Layer from your Exported Frame to your Menu image. It will appear above the black Background.
    Add, or manipulate your Button Layer Sets, as is required, keeping them together. Remember that Button #1 will be the Button Layer Set, that is lower down in the Layers Palette. This can play a roll with Button Routing, back in Encore. Lower Button Layer Sets will have lower Button numbers.
    Now, I always rename my Button Layer Sets, keeping the required characters - just changing the name. I also do all of my Button text in PS, and make sure to turn OFF Sync Button Names.
    When done, Save_As .PSD, and then Import_As_Menu into Encore. Note: if you start with the Blank Menu, you can choose Edit in Photoshop, and then when done in PS, you just need to Save, and it will update in Encore. This is a personal workflow choice. I do the Edit in Photoshop route, but it is not necessary. One just needs to Import the resulting .PSD into Encore with Import_As_Menu, so that Encore does all the things that it needs to and recognizes the .PSD as a Menu.
    When deciding what to base your Menu on, remember that you can "populate" your Menu with Buttons from the Functional Content. I’d suggest studying these Assets, and picking the ones that work best for you. You can still alter/edit those back in PS, so you just need to "get close."
    Pay special attention to the required naming conventions. You cannot deviate from those first characters in the Button Layer Sets. They MUST be followed.
    If you have any questions, do not hesitate to ask.
    Good luck,
    Hunt

  • Create a Fancy Custom Control

    I'm trying to create a fancy Custom Control for processing Cell Counter images.  I want a Control that lets me select two image types, Fluorescent or DAB, and if I choose Fluorescent, will let me pick Red, Green, or Blue.
    I created two Radio Button controls, one for Fluorescent/DAB, one for RGB, that look like this:
    I was hoping to "embed" the RGB control inside the Image Type control, yet have them retain their properties (a 2-element and 3-element Dialog Box).  When I did the simple drag-and-drop of RGB onto Image Type, it acted as though I added elements to a cluster, and I had a 5-element Dialog Box, not what I wanted.
    So I got clever and dragged Image Type on top of RGB.  Of course, if Image Type is in front, you don't see RGB.  However, if RGB is in front, you see both, but with ugly shadows around RGB (I made its label invisible).
    Anyone have an idea how I can Have my Cake and Eat It, Too?  Specifically, how can I get rid of the shadow that the RGB control casts on the Image Type control?
    Here are the controls, themselves, as snippets:
    Bob Schor
    Solved!
    Go to Solution.

    Duh ...  Thanks, Lynn!  Here is the result:
    Bob Schor

  • Saving a custom menu in Encore library

    I've been watching a training video for Encore and several days ago I recall the trainer stated that a custom menu can be saved to appear in the menu library along with all the standard menus that come with Encore.
    After creating a menu in Photoshop and importing it to Encore I have it working the way I want.  I would like to save this in the menu library to use with other projects, but now I can't find the section of the training video that described how to do that.
    Is it as simple as saving the PSD in the library folders on my hard drive where all the standard menu files are saved?  I don't want to corrupt the data base by doing somehting dumb so some advice here would be very helpful.
    Thanks,
    Jim

    It is the wrong forum, but what you want to do is simple.  Import it as a menu into the project.  Drag it from the project into the library>General window.  You will then be asked whether you want to save it as a standard menu or a template.  If you want it to be portable to other computers, also check self contained under template.  That simple.

  • Right Parameters for running a package in custom menu

    Hi Expert,
    In one of my project I am creating custom menu where I need to define various macros.I am getting error in one of the VBA code that is as follow:-
    Sub Step3_RunAlloc_Click()
    Application.Run "MNU_eDATA_SELECTPACKAGE", "Rent Allocation", "ZBPC_RENT_ALLOC", "Company",
    "Financial Processes"
    End Sub
    This code in giving error.Can anyone please suggest the solution and tell me what is the right parameters.I am working in SAP BPC 7.0 M.
    Thanks in Advance.
    Regards,
    Prakash

    Hi,
    Please find below the example from the BPC Help.
    Syntax for this command is MNU_eDATA_SELECTPACKAGE(ackage name>, <package file path>, <teamname>, <package group>)
    For only this menu command, the parameters are part of the MacroName so you must leave the Parameter section blank. For example, if you have MNU_eData_SelectPackage(""import"",""examples/import.dts"",""HQ"") in cell A1, FX Restatement in cell A2, your EvMNU function would be: EvMNU(A1,A2,).
    Can you please let me know what the error message you received?
    Best regards,
    Mihaela

  • BPC Custom Menu

    Hi
    We have created a Custom Menu in SAP BPC V5.1 SP7, BPC for Excel . When we run it, each
    time we open a report or schedule accessed from the custom menu it does
    not automatically expand and refresh on open so does not update the current view.  We need to manually expand and refresh each time.  This is despite the fact that we have set this in the workbook options of each of the reports and schedules.  However if we try opening the same reports or
    schedules from the eAnalyze  or eSubmit menus respectively they expand
    and refresh on open as expected. If we use the custom menu in test mode then it also works as expected by expanding and refreshing.  Is there a known bug with the custom
    menus or is there a setting that I need to change to get this to work?
    Kind Regards
    Wayne Newall

    Hi,
    Did you try to put the Visual Basic command (in "This Workbook") in the custom menu:
    Private Sub Workbook_Open()
    Application.Run ("MNU_ETOOLS_EXPANDANDREFRESH")
    end sub
    Regards,
    Anita

Maybe you are looking for

  • How do I move itunes library from my ipad back to my itunes library in my windows computer ?

    How do I move itunes library from my ipad back to my itunes library in my windows computer ? All the songs got transfered by mistake from my windows itunes library to my ipad. All i had wanted to do was to move a select # of songs newly purchased fro

  • In SLD WEB AS JAVA systems

    hi, I had a small query that for WEB AS ABAP we use application systems like APO,SCM etc but for WEB AS JAVA . which application systems are used ? regards guna

  • What is best cloning utility for MacBook Pro

    I am about ready (finally as Mountain Lion's release approaches) to upgrade my mid-2009 17 inch MacBook Pro from Snow Leopard to Lion.  Only pieces remaining are a hard drive to clone my internal 750mb hard drive to and the Lion sw itself. I know the

  • Help with Flash smooth transitions

    Can someone please tell me how I can make a Flash movie like this one here where it transitions smoothly from one image to another. I have been using Flash for a while at a basic level, but my attempts at such movies always seem to be jerky. When I c

  • Regarding a daatbase trigger

    I need to create a database trigger Requirements are The tax information should be inserted into gl_je_interface_headers and gl_je_interface_lines when import journal process takes place. My doubt is I have to put the trigger after insert on gl_je_in