An idea… IceWM Dynamic Desktop Menu

Forum Forums New users New Users and General Questions An idea… IceWM Dynamic Desktop Menu

This topic contains 63 replies, has 6 voices, and was last updated by BobC Sep 19-8:04 pm.

Viewing 15 posts - 1 through 15 (of 64 total)
  • Author
    Posts
  • #26663
    Member
    Avatar
    BobC

    The concept is that it could generate a dynamic menu of the
    ~/Desktop folder on the fly when you click it, and if there are any folders inside there, it makes those into sub-menus off that menu.

    It then generates the entries

    Other Desktops
    —separator line
    first entry
    second entry
    third might be Sub-menu folder option
    ——sub menu entries, you don’t see toll you hover over sub-menu
    fourth entry – last
    —separator line
    Pinboard toggle
    Conky toggle

    The items between the separator lines are each item in the folder or sub folder…

    Somehow I would need to figure out which was the correct icon set to use

    So if you have an old machine and are strapped for memory, you can put things into the desktop folder any way you like, and they appear on this dynamic desktop menu without needing to run the rox-filer or spacefm desktop in memory

    I wonder if I could just tell IceWM the name of the entry, maybe it would just run it, and if it was a .desktop file, I could look inside to find the name of the icon, otherwise maybe look for an icon with the same name somehow to grab the first one in a search hierarchy, or maybe just too bad, so sad, generic icon and at least you have a memory free menu that you can maintain super easily, and that would also work with the rox-filer or spacefm desktops as icons if either of those are running.

    Maybe I’m nuts… just an idea…

    #26666
    Member
    Avatar
    PPC

    Hi Bob!
    I’m not quite sure if I got what you meant- users can put stuff on the “personal” menu for easy access, right? (there’s a GUI application for it, that chooses the right icon for the entries, no need to parse .desktop files… Check out DO’s video about that: https://www.youtube.com/watch?v=wwuTtjF6zS0 )
    About the dynamic Menu – I saw on DistroTube YouTube channel, a while ago, that there’s a way to create on JWM (I’m assuming it also works on IceWM)- a dynamic Menu for recently used files/applications (I believe it was for files only, not apps, but I saw that a long time ago)- it fired up a script when the user hovered above that dynamic menu entry…

    I’m with you on the using rox/spacefm to manage my desktop- particularly on my RAM starved netbook- I tend to create quick launch icons on my toolbar (I made a gui script for doing that on IceWM, on JWM I do have to manually edit the config file.
    I believe most users not really need much more that access to browser, file manager, maybe a terminal, some office applications and a couple more applications (depending on the way you use your computer- steam/game links, a video editor, a music player, etc. A Log-out menu is also very handy (it’s provided in JWM, in antiX 19, and it’s easy to do the same on IceWM, but I never found out out to put it next to the toolbar’s clock like it is in JWM)…. You probably don’t have real need for more than a dozen of quick launch icons on the toolbar (or you dynamic menu idea).
    For me, using the icons on the toolbar is a perfect solution I have direct access to want I want- also avoiding wasting time navigating the menu, or wasting my RAM using desktop icons or docks…

    By the way- if you are willing to try JWM (that looks like a more striped version of IceWM desktop)- there’s a way to create a “dock” like toolbar, and put it on the top or the sides of the screen, and set it to auto-hide- I made a post about it- if you want to try it- search for my posts about JWM- it does not look as nice as a dock, but then again- it does not eat up your RAM- the problem, as always is the initial setup- you have to create an entry to every single application you want to add to the toolbars. I never digged on ICEWM config options enough to find out if one can do the same there…

    P.

    • This reply was modified 2 weeks, 2 days ago by PPC.
    • This reply was modified 2 weeks, 2 days ago by PPC.
    • This reply was modified 2 weeks, 2 days ago by PPC.
    #26673
    Member
    Avatar
    BobC

    PPC, I mean add menu entries with just a Drag and Drop, no muss, no fuss. Add it to the ~/Desktop folder any way you please, and the next time you click the Desktop menu option it is there on the list.

    Yes, I use the toolbar a lot too.

    I like the idea of creating and maintaining .desktop entries or dropping in script files to drive menus. I wish I would find a good, lean and functional .desktop file maintenance program that people could use to copy and tweak them easily.

    I’m not trying to cut down what currently exists, just trying to use the new dynamic menus to provide something better at essentially little or no cost.

    #26677
    Member
    Avatar
    PPC

    Bob- because I previously patched together a “Toobar Icon Manager” for ICEWM (a gui way to edit icewm’s toolbar file and add new icons or delete the icons further to the right) I altered it to allow for fast editing IceWM’s personal menu- you launch my script and then can select what .desktop file to add to the personal menu (or drag and drop the .desktop file, like you wanted). Just confirm the selection and you instantly have a new personal menu entry (or can delete existing entries). I felt it was safer to just edit the ~/.icewm/personal file than directly the menu…
    You wanted your apps to be added to the “Desktop” – but this way they will be added, instantly- via drag and drop to the “Personal” menu. Unfortunately I found no way to create subfolders using my script… sorry for that- I’m not really a programmer, I just adapt stuff I find on-line and shape everything into a working script…
    I hope even with all these limitations, this script can improve your antiX computing life… It’s quite a bit faster than using the edit personal menu from CC, and also allows drag and drop, and you can type in the file selection box, making selecting .desktop files considerably faster… For maximum safety users should only use the tools provided on the CC… but…
    If you are interested, you can test this script: copy and paste the code the a empty .sh file (like “fast_personal_menu_editor.sh”), make it executable and run it… It’s a beta, patched together from the beta of my Toolbar Icon Manager- so it’s a beta created from another beta- I didn’t find any bugs, but please be carefull using this script.
    Missing Features- any terminal application selected using my scripts won’t run- I’ve yet to add the option to check if the application runs in a terminal and alter the entry considering that information…

    P.

    #!/bin/bash
    # Adds a new tool bar icon (from a .desktop file) to the IceWM desktop toolbar- antiX 19
    # By PPC, 30/7/2019, adapted from many, many on-line examples
    # No licence what so ever- feel free to improve/adapt this script
    # To do: 1- allow to list/move/delete icons from the toolbar (huge re-write- the app was meant originaly to add icons only, but I thought it was a nice way to allow some basic icon deletion funtions. -https://pastebin.com/imRHPw9k
    # 4-9-2019- EDITED TO SERVE AS FASTER PERSONAL MENU EDITOR
    
    DADOS=$(yad --length=800 --width=800 --center --paned --splitter="200" --title="Fast Personal Menu Manager for IceWM BETA 2" \
    --form --field='App .desktop file':FL '/usr/share/applications/antix' \
    --button=gtk-cancel:1 \
    --button="REMOVE last entry":2 \
    --button="ORGANIZE entries":4 \
    --button="UNDO last change":3 \
    --button="ADD selected app":0 \
    --wrap --text="  Choose (or drag and drop to the field below) the .desktop file you want to add to the personal menu \n OR select any other option  ")
    
    ### wait for a button to be pressed then do the needed funtion
    foo=$?
    
    [[ $foo -eq 1 ]] && exit 0
    
    		###Function to manually arrange icons
    		if [[ $foo -eq 4 ]]; then   cp ~/.icewm/personal ~/.icewm/personal.bak &&	yad --center --form --title="Fast Personal Menu Manager for IceWM " --field="Warning::TXT" " FPM has no 'graphical' way to allow users to move icons around or delete arbitrary icons.\n If you click OK, the personal menu configuration file will be open for edition.\n Each toolbar icon is identified by a line starting with 'prog' followed by the application name, icon location and the application executable file. \n Move or delete the intire line refering to each personal menu entry.\n Note: Lines starting with # are comments only and will be ignored.\n There can be empty lines.\n Save any changes and then restart iceWM.\n You can undo the last change from FPMs "Restore" button." --width=400 --height=360  && geany ~/.icewm/personal
    		fi 
    		###END of Function to manually arrange icons
    		
    		###Function to delete last icon
    	
    if [[ $foo -eq 2 ]]; then
    
    			### Does not allow to remove the first $mininumlines "toolbar" file lines  -> meant to not allow delete the show desktop, eject usb and the TIM icons from the toolbar 
    			mininumlines=1
    			a=($(wc ~/.icewm/personal))
    			existinglines=${a[0]}
    			if [ "$mininumlines" -gt "$existinglines" ]; then  yad --title='Warning' --text='  FTM is programed to always keep 1 line in the personal menu file! If you want to, do it manually!  ' --timeout=3 --no-buttons --center; exit
    			fi
    			###
    
    yad --title='Warning' --text='  This will the delete the last entry from your personal menu! Are you sure?  ' --center --button=gtk-cancel:1 \ --button=gtk-cancel:1 --button=gtk-yes:0 
      confirm=$?
      if [[ $confirm -eq 1 ]]; then exit
      fi
    
    #create backup file before changes
    cp ~/.icewm/personal ~/.icewm/personal.bak
    #TRY to Remove last icon on the toolbar
    BADLINESCOUNT=1
    ORIGINALFILE=~/.icewm/personal
    truncate -s $(printf "$(stat --format=%s ${ORIGINALFILE}) - $(tail -n${BADLINESCOUNT} ${ORIGINALFILE} | wc -c)\n" | bc ) ${ORIGINALFILE}
    #Restart ICewm to the change is instantly available
    icewm --restart
    	exit
    fi
    		###END of Function to delete last icon
    
    		###Function to restore last backup
    if [[ $foo -eq 3 ]]; then
    cp ~/.icewm/personal.bak ~/.icewm/personal
    icewm --restart
    exit 
    fi 
    		###END Function to restore last backup
    
    if [[ $foo -eq 0 ]]; then
    
    		###Function to add a new icon
    
    COMANDO0=$(echo "$DADOS" | cut -d'|' -f1)
    #this strips any existing path from the name:
    EXEC0=$(grep Exec= $COMANDO0 | cut -d '=' -f2)
    EXEC=$(echo "$EXEC0" | cut -f1 -d" ")
    #this strips any existing path from the name:
    COMANDO00=$(basename $COMANDO0)
    #this strips any existing .desktop from the name:
    REMOVE=".desktop"
    NOME=${COMANDO00//$REMOVE/}
     #try to find app icon:
    	ICON0=$(grep Icon= $COMANDO0 | cut -d '=' -f2)
    	ICON00=$(echo "$ICON0" | cut -f1 -d" ")
    	ICONwithoutpath=$(basename $ICON00)
    	ICON0=$(grep Icon= $COMANDO0 | cut -d '=' -f2)
    	ICON00=$(echo "$ICON0" | cut -f1 -d" ")
    	ICONwithoutpath=$(basename $ICON00)
    	path="/usr/share/icons/papirus-antix/24x24/apps/"
    	extension=".png"
    
    if [ "$ICON00" == "$ICONwithoutpath" ]; then
        ICONE=$path$ICONwithoutpath$extension
        ### CHECk IF ICONE exits in default Path
    else
        ICONE="/usr/share/icons/papirus-antix/24x24/apps/yast-runlevel.png"
    fi
      
      #IF ICON not found on that path, try other path and if still not found, use default  
    if [ -f "$ICONE" ]; then OK=OK
    else 
       path="/usr/share/pixmaps/"
       ICONE=$path$ICONwithoutpath$extension
            if [ -f "$ICONE" ]; then OK=OK
    		else 
    		ICONE="/usr/share/icons/papirus-antix/24x24/apps/yast-runlevel.png"
    		fi
    fi
        
    # error if no application selected- avoids creating empty icon on toolbar:
    if [ -z "$EXEC" ]; then yad --title='Warning' --text='No changes were made! Please choose a application.' --timeout=3 --no-buttons --center
    	exit
    fi
    
    #create backup file before changes
    cp ~/.icewm/personal ~/.icewm/personal.bak
    
    #open .desktop file and get EXEC= contents
    EXEC0=$(grep Exec= $COMANDO0 | cut -d '=' -f2)
    #in case EXEC has more than one line, use only the first
    readarray -t lines < <(echo "$EXEC0")
    EXECperc="${lines[0]}"
    
    #add line to personal menu file - the | cut -f1 -d"%"   part removes any %x option from the exec command.
    echo "prog "\"${NOME}"\" "${ICONE}" "${EXECperc}""| cut -f1 -d"%"  >> ~/.icewm/personal
    #instantly restart IceWm so the new icon appears
    icewm --restart
    		###END of Function to add a new icon
    
    exit
    
    fi
    
    
    • This reply was modified 2 weeks, 1 day ago by PPC.
    #26683
    Member
    Avatar
    BobC

    That’s quite a script for someone that doesn’t code. I’ll have a look and give it a try.

    It’s a different approach than what I was thinking, but I’d be interested in that functionality also.

    #26689
    Forum Admin
    anticapitalista
    anticapitalista

    That script is included in antix-goodies so if you have upgraded any of the betas you can find it in /usr/local/bin

    Philosophers have interpreted the world in many ways; the point is to change it.

    #26716
    Member
    Avatar
    BobC

    Thanks, anti.

    PPC, I tried it from the repos (as long as anti put it in, I might as well help test it), and I used it to add itself to the toolbar 🙂

    IMO, it needs a desktop entry and an icon…

    IceWM_Toolbar_Icon_Manager.desktop

    [Desktop Entry]
    Encoding=UTF-8
    Name=IceWM Toolbar Icon Manager
    Exec=/usr/local/bin/icewm-toolbar-icon-manager.sh
    Icon=antix-logo
    Categories=X-Personal;
    NoDisplay=False
    Terminal=False
    

    I’m no good with graphics, but I found a free pic that maybe could be part of the basis for a good icon for it

    PS: This might be closer to an icon, not quite right, though…

    #26722
    Member
    manyroads
    manyroads

    As a long time Stacking window manager user (XFCE) I think I understand what you are trying to do. Some the issues that are going to present a challenge to you guys on your tiny machines, especially, are items like:
    — memory (RAM and video): Storing desktop files and images take memory not much maybe… but on a RAM starved unit as mentioned by PPC every little bit ‘hurts’.
    — Desktops burn resources too. On most modern PCs are barely even noticeable amounts; the consumption is all but invisible… but not so on your 512MB PC @BobC

    What I have been trying lately is to live without a Desktop (at least the typical variants as they tend to exist on XFCE, iceWM, Gnome, KDE and similar). It’s a mental challenge but I’m getting there. (It’s good for an old guy to try new things. 😉 ) The only indispensable functions I find I ‘absolutely’ need involve task management & program launching. Luckily many of those functions are easily handled with lightweight tools, like polybar, dmenu, rofi, tint2, yad/zenity, etc. (You can pick the one(s) that fit your needs best.)

    I have used combinations on my XFCE Desktop (tested and deployed first on my bspwm setup). They work equally well for me on XFCE and they also work well on jwm. I have published bunches of information related to the above on my site. Specific topics that might offer relevant options include items filed under:
    — Dialog Tools
    — Panels & Menus
    — bspwm (especially the items on Creating Help files & Tools & Task Management (across Workspaces & across the entire Desktop)

    Feel free to use anything that might be of value.

    Knowledge Base

    • This reply was modified 2 weeks, 1 day ago by manyroads.

    Pax Vobiscum,
    Mark Rabideau aka. manyroads
    "For every complex problem there is an answer that is clear, simple, and wrong." ---H. L. Mencken

    #26724
    Forum Admin
    anticapitalista
    anticapitalista

    I’m no good with graphics, but I found a free pic that maybe could be part of the basis for a good icon for it

    PS: This might be closer to an icon, not quite right, though…

    Lets see noClue’s reaction 🙂

    Philosophers have interpreted the world in many ways; the point is to change it.

    #26758
    Member
    Avatar
    PPC

    Hi, anticapitalista- Thanks, I didn’t know that some of the scripts I suggested were included in antix-goodies, that’s good to know!- but, like with many goodies- if they are not on the menus or on the CC, most users won’t know those goodies are available… You even used the yad-volume idea!!! If you want, I can send you the “vertical” yad-volume… I also have, somewhere on my drive (I hope) a “set time and date” script that has a option to sinc time/date over google’s server, using the chosen timezone… The script still lacks a lot on the visual side, but it does what it’s supposed to do!

    More on topic: it’s not really the same script- I adapted “TIM” to edit the “personal” configuration file, instead of the “toolbar” file and made some cosmetic changes to reflect that, so Bob would have a similar “resource” to what he wanted- a drag and drop way to add files to the menu, but only the “personal” menu- other than the menu editor from CC.
    I liked Bob’s .desktop! I liked the icon too, but I’m basically a minimalist- I choose a “+” sign as its icon- because the script is basically a way to “add” icons :-). I use it on the toolbar- it makes sense that the way to add icons to the toolbar is on the toolbar itself, right?
    @ Bob: thanks for your work, to allow easier access to that script!

    EDIT: my IceWM toolbar file (on my test machine) looks like this:

    prog "Unplug Removable Device" /usr/share/icons/papirus-antix/48x48/devices/drive-removable-media-usb.png unplugdrive.sh
    prog "IceWm Toolbar Icon Manager (add/remove icons)" /usr/share/icons/papirus-antix/22x22/actions/add.png icewm-toolbar-icon-manager.sh
    prog "File Manager" /usr/share/icons/papirus-antix/48x48/apps/file-manager.png desktop-defaults-run -fm
    prog "Web Browser" /usr/share/icons/papirus-antix/48x48/apps/web-browser.png desktop-defaults-run -b

    P.

    • This reply was modified 2 weeks ago by PPC.
    #26759
    Member
    Avatar
    BobC

    Manyroads, yes, I can heat a room with my Dual Pentium III with its 10,000 RPM drives, etc. Once upon a time it was an NT 4.0 server supporting 120 users doing all the database stuff.

    anti, yes, I know. At least I know ahead of time where things will be not so great. But at least I found something as a suggestion of what would make sense conceptually rather than say/doing nothing.

    Oh well, its not a perfect world, we just plug away and things improve a bit here, a bit there, and pretty soon things take shape and bring more smiles…

    #26761
    Member
    manyroads
    manyroads

    @BobC given the age of some of your devices… perhaps you might start a thread here describing any parts (like memory etc) you might need. Others could chime in as well. I know that I have some arcane memory, drives, etc that I’d be willing to give to anyone willing to pay for the mailing. Just an idea.

    Pax Vobiscum,
    Mark Rabideau aka. manyroads
    "For every complex problem there is an answer that is clear, simple, and wrong." ---H. L. Mencken

    #26765
    Forum Admin
    anticapitalista
    anticapitalista

    @PPC – send me your stuff, I can’t promise that they will all be used though.
    AK-47 has written a date and time app that I have been testing on antiX.

    MX Date and Time

    re – letting users know they are there ie in the control centre or menu.
    This has been a constant debate ever since antiX started.
    Cluttered menu v lean menu.
    ‘Sensible’ default options v let user decide philosophy.

    Philosophers have interpreted the world in many ways; the point is to change it.

    #26769
    Member
    Avatar
    BobC

    My antiques are fine. I put $15 into them in June so I could test antiX19 with them, as they are my last 32 bit machines. I don’t really spend much time on them otherwise. If only I could get that POD racing game running again…. I loved that game.

    #26809
    Member
    noClue
    noClue

    Something like this would be better fit for Papyrus … Your suggestion would better fit hicolor style.

    How strange is to be anything at all. (Alice in Wonderland)

Viewing 15 posts - 1 through 15 (of 64 total)

You must be logged in to reply to this topic.