Forum › Forums › General › Software › Dynamic Toolbar or App grid menu that adds/removes options dynamically
- This topic has 39 replies, 8 voices, and was last updated Oct 28-11:10 am by BobC.
-
AuthorPosts
-
August 29, 2021 at 6:44 pm #66018Moderator
BobC
::skidoo, The problem with all of the alternatives, for me, was that somehow I needed to translate the log output into something I could use to identify which menu or toolbar option had been run, and that was why I tried to get the IceWM Devs to directly add output of what was called when it was called. I tried to figure out how to add it myself and never was able to figure it out. What’s really sad is that I couldn’t figure it out. My only excuse is lack of knowledge and effort to learn C++ to figure it out.
The output from xlsclients shows the programs I was looking for, but the ones running, rather than the programs called. The snoopski seems to be designed to show each call rather than a picture of what is running, which is what I needed to do the exponential average calculations the way I usually have done in the past.
I wish I could find a way to associate the programs called with the menu/toolbar options. That’s the missing piece to the puzzle.
August 29, 2021 at 7:58 pm #66023Member
oops
::FI: A top 5 or top10 of the most used Apps can be easy done with tint2, and a simple user folder eg: “~/tint2_panel/top5/”, by coping the 5 or 10 most .desktop files used from: usually /usr/share/applications/ to this folder.
tint2 -c ~/tint2_panel/top5/tint2_top5.dockThe ~/tint2_panel/top5/tint2_top5.dock file sample:
#---- Generated by tint2conf 75a8 ---- # See https://gitlab.com/o9000/tint2/wikis/Configure for # full documentation of the configuration options. #------------------------------------- # Gradients # Gradient 1 #------------------------------------- # Backgrounds # Background 1: rounded = 0 border_width = 0 border_sides = TBLR border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #252525 67 border_color = #303030 67 background_color_hover = #151515 67 border_color_hover = #303030 67 background_color_pressed = #151515 67 border_color_pressed = #303030 67 # Background 2: Tâche icônifiée, Tâche par défaut rounded = 0 border_width = 1 border_sides = TBLR border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #252525 67 border_color = #151515 67 background_color_hover = #151515 67 border_color_hover = #505050 67 background_color_pressed = #303030 67 border_color_pressed = #505050 67 # Background 3: Barre des tâches active, Panel, Tâche active rounded = 2 border_width = 1 border_sides = TBLR border_content_tint_weight = 40 background_content_tint_weight = 50 background_color = #252525 67 border_color = #505050 67 background_color_hover = #252525 67 border_color_hover = #505050 67 background_color_pressed = #252525 67 border_color_pressed = #505050 67 # Background 4: Tâche urgente rounded = 0 border_width = 0 border_sides = TBLR border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #aa4400 67 border_color = #aa7733 67 background_color_hover = #aa4400 67 border_color_hover = #aa7733 67 background_color_pressed = #aa4400 67 border_color_pressed = #aa7733 67 # Background 5: Infobulle rounded = 0 border_width = 1 border_sides = TBLR border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #252525 67 border_color = #000000 67 background_color_hover = #252525 67 border_color_hover = #000000 67 background_color_pressed = #252525 67 border_color_pressed = #606060 67 # Background 6: Nom du bureau inactif rounded = 2 border_width = 1 border_sides = TBLR border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #202020 67 border_color = #101010 67 background_color_hover = #151515 67 border_color_hover = #404040 67 background_color_pressed = #202020 67 border_color_pressed = #404040 67 # Background 7: Nom du bureau actif rounded = 2 border_width = 2 border_sides = B border_content_tint_weight = 0 background_content_tint_weight = 0 background_color = #151515 67 border_color = #d9d9d9 100 gradient_id = 0 background_color_hover = #101010 67 border_color_hover = #404040 67 background_color_pressed = #202020 67 border_color_pressed = #404040 67 #------------------------------------- # Panel panel_items = P:L:P panel_size = 100% 36 panel_margin = 75 0 panel_padding = 1 1 1 panel_background_id = 3 wm_menu = 1 panel_dock = 1 panel_pivot_struts = 0 panel_position = top center horizontal panel_layer = top panel_monitor = all panel_shrink = 1 autohide = 0 autohide_show_timeout = 0 autohide_hide_timeout = 0.5 autohide_height = 1 strut_policy = follow_size panel_window_name = tint2-top5 disable_transparency = 0 mouse_effects = 1 font_shadow = 0 mouse_hover_icon_asb = 100 -2 14 mouse_pressed_icon_asb = 100 0 15 scale_relative_to_dpi = 0 scale_relative_to_screen_height = 0 #------------------------------------- # Taskbar taskbar_mode = multi_desktop taskbar_hide_if_empty = 1 taskbar_padding = 2 2 0 taskbar_background_id = 0 taskbar_active_background_id = 3 taskbar_name = 1 taskbar_hide_inactive_tasks = 0 taskbar_hide_different_monitor = 0 taskbar_hide_different_desktop = 0 taskbar_always_show_all_desktop_tasks = 1 taskbar_name_padding = 2 2 taskbar_name_background_id = 6 taskbar_name_active_background_id = 7 taskbar_name_font = Noto Sans 9 taskbar_name_font_color = #909090 100 taskbar_name_active_font_color = #cccccc 100 taskbar_distribute_size = 0 taskbar_sort_order = none task_align = left #------------------------------------- # Task task_text = 1 task_icon = 1 task_centered = 1 urgent_nb_of_blink = 0 task_maximum_size = 145 48 task_padding = 5 2 5 task_font = Noto Sans 9 task_tooltip = 1 task_thumbnail = 1 task_thumbnail_size = 240 task_font_color = #aaaaaa 100 task_active_font_color = #cdcdcd 100 task_urgent_font_color = #ffffff 100 task_iconified_font_color = #aaaaaa 100 task_icon_asb = 100 0 0 task_background_id = 2 task_active_background_id = 3 task_urgent_background_id = 4 task_iconified_background_id = 2 mouse_left = toggle_iconify mouse_middle = none mouse_right = close mouse_scroll_up = none mouse_scroll_down = none #------------------------------------- # System tray (notification area) systray_padding = 0 0 2 systray_background_id = 0 systray_sort = ascending systray_icon_size = 16 systray_icon_asb = 100 0 0 systray_monitor = 1 systray_name_filter = #------------------------------------- # Launcher launcher_padding = 1 0 2 launcher_background_id = 0 launcher_icon_background_id = 0 launcher_icon_size = 24 launcher_icon_asb = 100 0 0 launcher_icon_theme_override = 1 startup_notifications = 0 launcher_tooltip = 1 launcher_item_app = tint2conf.desktop launcher_apps_dir = ~/tint2_panel/top5 #------------------------------------- # Clock time1_format = %H:%M time2_format = %a %-d %b time1_font = Noto Sans Bold 10 time1_timezone = time2_timezone = time2_font = Noto Sans 7 clock_font_color = #fffba7 100 clock_padding = 6 1 clock_background_id = 0 clock_tooltip = %A %d %B %Y clock_tooltip_timezone = clock_lclick_command = orage clock_rclick_command = xterm -geometry 30x12+40+40 -hold -e "cal" clock_mclick_command = yad --calendar --undecorated --mouse --details=$HOME/yad-calendar.txt --button="X":1 clock_uwheel_command = gsimplecal clock_dwheel_command = #------------------------------------- # Battery battery_tooltip = 1 battery_low_status = 10 battery_low_cmd = bash -c "[[ -z $(acpi 2>/dev/null) ]] && { ;} || { notify-send 'battery low'; }" battery_full_cmd = bat1_font = Noto Sans 7 bat2_font = Noto Sans 6 battery_font_color = #adffbc 100 bat1_format = bat2_format = battery_padding = 1 0 battery_background_id = 0 battery_hide = 101 battery_lclick_command = battery_rclick_command = battery_mclick_command = battery_uwheel_command = battery_dwheel_command = ac_connected_cmd = ac_disconnected_cmd = #------------------------------------- # Button 1 button = new button_icon = /usr/bin/action-Moka-19png_xpm/system-run.png button_text = button_tooltip = "rofi -show drun /synapse/ xfce4-appfinder..." button_lclick_command = rofi -show drun button_rclick_command = xfce4-appfinder button_mclick_command = synapse button_uwheel_command = button_dwheel_command = button_font_color = #000000 100 button_padding = 1 0 button_background_id = 0 button_centered = 0 button_max_icon_size = 0 #------------------------------------- # Button 2 button = new button_icon = /usr/share/icons/Papirus/22x22/apps/system-shutdown.svg button_text = button_tooltip = "killall tint2 Exit /VeillePC/ i3lock_screen..." button_lclick_command = killall tint2 button_rclick_command = i3lock -c 000000 button_mclick_command = dbus-send --system --print-reply --dest=org.freedesktop.login1 /org/freedesktop/login1 "org.freedesktop.login1.Manager.Suspend" boolean:true button_uwheel_command = button_dwheel_command = button_font_color = #000000 100 button_padding = 1 0 button_background_id = 0 button_centered = 0 button_max_icon_size = 0 #------------------------------------- # Tooltip tooltip_show_timeout = 0.3 tooltip_hide_timeout = 0.1 tooltip_padding = 5 2 tooltip_background_id = 5 tooltip_font_color = #cccccc 100 tooltip_font = Noto Sans 9August 30, 2021 at 7:23 am #66048ModeratorBobC
::skidoo, snoopski sure does remind me of all the STUFF that I have running that I had implemented at some point but rarely use, but it isn’t catching the apps run from the menu or toolbar that I ran testing it. I checked the /etc/snoopski.ini and it looks right, ie excludes user 0, same as the default on gitlab.
I think the best thing I can think of at this point is to change my concept to using the output from xlsclients and seeing how bad the impact is on the system to run that once every XX seconds on an old Pentium II, and if it isn’t bad, then try running it from cron, appending to a log, and then see how much effort it is for the system to summarize and analyze the log. I think the top 25 programs list will probably contain the same ones once the reserved and excluded are accounted for.
Maybe I should call the reserved ones #LOCKED instead to denote that they are included and locked in place.
I think the default #LOCKED list should be (and would welcome suggestions for additions/deletions or sequence):
Unplug Removable Device
Screenshot
Control Centre
App-Select
Default Terminal
Default Web Browser
Default File Manager
Default Text Editor
LibreOffice
GalculatorBTW, I use a double height, auto hiding toolbar, so there is plenty of room for many icons, and it doesn’t use screen space except when I want it to. It would also be possible to include other programs in the default setup, but not lock them in place, and that way they would roll off the end of the list when other programs were run and added over time.
I would think the rest would be added for me within a few months as they get used…
Maybe there is a way to add a way to switch the settings back and forth to the default antiX IceWM screen layout so people can decide for themselves what they like.
August 30, 2021 at 7:36 am #66050ModeratorBobC
::Oops, Thanks for the tint2 info. Yes, tint2 is the other toolbar setup I like by default because of it’s fancy setup program as PPC’s programs have shown, but if I could make it work with the standard IceWM toolbar, I’d be satisfied for my own use.
Someone like Moddit could provide initial input based on his experiences with setting this kind of thing up, and solicit user reactions and suggestions to add to what we get here. The idea is to provide a good basic setup out of the box, and then it learns and adjusts as it’s used, resulting in very efficient workflows, even on old low horsepower systems.
August 31, 2021 at 3:43 am #66126ModeratorBobC
::I was successful getting it to log the xwindows apps that are running, and I think I should be able to analyze the results.
#!/bin/bash # xappsrunninglogger - appends log of current days since epoch and running xwindows app names to logfile /tmp/xappsrunning.log every 30 seconds (120x per hour, 2640x per day) while :; do daynumber=$(echo $(($(date --utc --date "$1" +%s)/86400))) && xlsclients | awk '{print $2}' | sed 's/.*\///g' | sort | uniq | awk -v daynumber=$daynumber '{print $1, daynumber, 1}' >> /tmp/xappsrunning.log awk 'BEGIN { FS=OFS=SUBSEP=" "}{arr[$1,$2]+=$3 }END {for (i in arr) print i,arr}' /tmp/xappsrunning.log > /tmp/xappsrunningsummary.log mv /tmp/xappsrunningsummary.log /tmp/xappsrunning.log sleep 30 doneExample of detailed log file output, columns are program, day #, occurences for the day:
icewm 18870 55 firefox-esr 18870 55 roxterm 18870 55 geany 18870 55August 31, 2021 at 3:56 am #66127ModeratorBobC
::Well, that was short lived and too good to be true I guess…
I ran the antiX Control Centre, and in ps -ef it appears as antixcc, but xlsclients shows it as gtkdialog
$ xlsclients XPS15-7559 /usr/bin/icewm --notify XPS15-7559 firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 /usr/lib/firefox-esr/firefox-esr XPS15-7559 geany XPS15-7559 roxterm XPS15-7559 gtkdialogroot 10787 1 0 22:13 ? 00:00:00 /usr/bin/slim -d root 10790 10787 2 22:13 tty7 00:01:02 \_ /usr/lib/xorg/Xorg -nolisten tcp -background none -aut bobc 10823 10787 0 22:14 ? 00:00:00 \_ /bin/bash /usr/local/bin/desktop-session bobc 10870 10823 0 22:14 ? 00:00:00 \_ /usr/bin/icewm-session bobc 10872 10870 0 22:14 ? 00:00:00 \_ /usr/bin/icewmbg bobc 10873 10870 0 22:14 ? 00:00:04 \_ /usr/bin/icewm --notify bobc 15527 10873 0 22:44 ? 00:00:00 \_ /bin/bash /usr/local/bin/antixcc.sh bobc 15710 15527 0 22:44 ? 00:00:00 \_ gtkdialog --program=ControlCenterMy log file:
firefox-esr 18870 123 icewm 18870 123 gtkdialog 18870 52 roxterm 18870 123 geany 18870 123Back to the drawing board….
- This reply was modified 1 year, 8 months ago by BobC.
August 31, 2021 at 8:51 am #66134Member
zblsv
::I ran the antiX Control Centre, and in ps -ef it appears as antixcc, but xlsclients shows it as gtkdialog
May be, this will be more informative:
ps -U $(whoami) -Ho pid,argsIt shows something like
24257 /bin/bash /usr/local/bin/desktop-session 24305 /usr/bin/fluxbox 26258 /bin/bash /usr/local/bin/antixcc.sh 26437 gtkdialog --program=ControlCenterYou can analyze straightly this instead of xlsclients output.
Words are carried away by the wind...
August 31, 2021 at 10:46 am #66136Member
oops
::I was successful getting it to log the xwindows apps that are running, and I think I should be able to analyze the results.
#!/bin/bash # xappsrunninglogger - appends log of current days since epoch and running xwindows app names to logfile /tmp/xappsrunning.log every 30 seconds (120x per hour, 2640x per day) while :; do daynumber=$(echo $(($(date --utc --date "$1" +%s)/86400))) && xlsclients | awk '{print $2}' | sed 's/.*\///g' | sort | uniq | awk -v daynumber=$daynumber '{print $1, daynumber, 1}' >> /tmp/xappsrunning.log awk 'BEGIN { FS=OFS=SUBSEP=" "}{arr[$1,$2]+=$3 }END {for (i in arr) print i,arr<em class="d4pbbc-italic">}' /tmp/xappsrunning.log > /tmp/xappsrunningsummary.log mv /tmp/xappsrunningsummary.log /tmp/xappsrunning.log sleep 30 doneExample of detailed log file output, columns are program, day #, occurences for the day:
icewm 18870 55 firefox-esr 18870 55 roxterm 18870 55 geany 18870 55… Very good, now you can fill your the TOP4 tint2 folder.
September 1, 2021 at 12:25 am #66163ModeratorBobC
::Oops, I hit some that don’t work, so had to give up on xlsclients
zblsv, Thanks, At first that looks very difficult, but your code eliminated a lot of unneeded “stuff”.
As a test of concept, I came up with this command:
For the benefit of those reading and learning or teaching, the intent is:
1. get a list of what I have running and put it in a temp file
2. print the temp file and delete the heading line
3. remove leading whitespace from all lines
4. remove the first pid column
5. remove leading whitespace from all lines
6. convert lines running /bin/bash or /usr/bin/python3 to convert the space after into a tilde to combine that with the command that follows
7. print just the first column which is now the command, sort and eliminate duplicates
8. remove any commands found in the exclude list$ ps -U $(whoami) -Ho pid,args > ~/tempfile && cat ~/tempfile | sed 1d | sed 's/^[ \t]*//' | cut -f2- -d" " | sed 's/^[ \t]*//' | sed 's/^\/bin\/bash /\/bin\/bash~/g' | sed 's/^\/usr\/bin\/python3 /\/usr\/bin\/python3~/g' | awk '{print $1}' | sort | uniq | grep -v -x -f ~/xapps-exclude.lstThe results were:
alsamixer /bin/bash~/usr/local/bin/antixcc.sh geany gnome-mahjongg roxterm spacefm /usr/bin/mc /usr/bin/python3~/usr/bin/blueman-manager /usr/bin/python3~/usr/bin/zim /usr/games/sol /usr/lib/firefox-esr/firefox-esr xfe zzzfmMy xapps-exclude.lst contains:
bash /bin/bash /bin/bash~/home/bobc/bin/antix-calendar.sh /bin/bash~/home/bobc/bin/yad-update-prep.sh /bin/bash~/usr/local/bin/desktop-session /bin/bash~/usr/local/bin/yad dbus-launch gtkdialog ps sleep /usr/bin/dbus-daemon /usr/bin/icewm /usr/bin/icewmbg /usr/bin/icewm-session /usr/bin/yad /usr/lib/at-spi2-core/at-spi2-registryd /usr/lib/at-spi2-core/at-spi-bus-launcher /usr/lib/dconf/dconf-service /usr/bin/python3~/usr/bin/blueman-applet /usr/lib/bluetooth/obexd- This reply was modified 1 year, 8 months ago by BobC.
September 1, 2021 at 2:03 am #66170Member
zblsv
::If so, then the further improvements of the ps usage:
ps -U $(whoami) --no-headers -o argsps -U $(whoami) --no-headers -o args | egrep -v "^grep|^-bash\$|^ps -U $(whoami) --no-headers -o args\$|^fbxkb\$|^conky\$|^/usr/bin/udevil|^/usr/bin/dbus-daemon|^dbus-launch|^/bin/bash /usr/bin/devmon|^/bin/bash /usr/local/bin/desktop-session"Words are carried away by the wind...
September 1, 2021 at 2:37 am #66172Member
zblsv
::I think, apps must be excluded by the regexp, not by the name only…
But at the moment I cannot give a proof example.Words are carried away by the wind...
September 1, 2021 at 5:21 am #66173Member
zblsv
::I have not found an example that needs regexp.
Some commands produces no ps output at all.
desktop-defaults-run -b file:/usr/share/antiX/FAQ/index.html
will not execute Firefox if it is already running.
But such cases are negligible, I think.Words are carried away by the wind...
September 1, 2021 at 1:24 pm #66203ModeratorBobC
::I have revised the code to include some of your ideas. I have had trouble with the antix-calendar script. I’ve also had problems with other scripts that call programs that run from cron that I don’t run from the menus. I will need to exclude them I suppose.
To do: Current code doesn’t do temp files or config options nicely. Need to ignore the xappslogger program itself
#!/bin/bash # xappsrunninglogger - appends log of current days since epoch and running xwindows app names to logfile ~/xappsrunning.log every 60 seconds (60x per hour=1320x per day) while :; do daynumber=$(echo $(($(date --utc --date "$1" +%s)/86400))) ps -U $(whoami) -o args > ~/tempfile && cat ~/tempfile | sed 1d | sed 's/^\/bin\/bash /\/bin\/bash~~~/g' | sed 's/^\/usr\/bin\/python3 /\/usr\/bin\/python3~~~/g' \ | awk '{print $1}' | sort | uniq | grep -v -x -f ~/xapps-ignore.lst | awk -v daynumber=$daynumber '{print $1, daynumber, 1}' >> ~/xappsrunning.log awk 'BEGIN { FS=OFS=SUBSEP=" "}{arr[$1,$2]+=$3 }END {for (i in arr) print i,arr}' ~/xappsrunning.log > ~/xappsrunningsummary.log sort < ~/xappsrunningsummary.log > ~/xappsrunning.log rm -f ~/xappsrunningsummary.log sleep 60 done~/xapps-ignore.lst – ie don’t track these
bash /bin/bash /bin/bash~~~/home/bobc/bin/antix-calendar.sh /bin/bash~~~/home/bobc/bin/yad-update-prep.sh /bin/bash~~~/usr/local/bin/desktop-session /bin/bash~~~/usr/local/bin/yad dbus-launch gtkdialog ps sleep /usr/bin/dbus-daemon /usr/bin/icewm /usr/bin/icewmbg /usr/bin/icewm-session /usr/bin/yad /usr/lib/at-spi2-core/at-spi2-registryd /usr/lib/at-spi2-core/at-spi-bus-launcher /usr/lib/dconf/dconf-service /usr/bin/python3~~~/usr/bin/blueman-applet /usr/lib/bluetooth/obexd /bin/sh wc conky fbxkb /usr/bin/udevil /bin/bash~~~/usr/bin/devmon /bin/bash~~~/home/bobc/bin/xappsrunninglogger /usr/lib/x86_64-linux-gnu/gconf/gconfd-2September 1, 2021 at 2:55 pm #66207Member
zblsv
::echo is superfluous:
daynumber=$(($(date --utc --date "$1" +%s)/86400))Avoid piping cat to sed (not so bad, but slightly more efficient):
sed 1d ~/tempfile | ...Will you need tempfile later on?
If so, tee can be used:
ps -U $(whoami) --no-headers -o args | tee tempfile | sed 's/^\/bin\/bash /\/bin\/bash~~~/g'There are more interpreters than bash and python for ~~~ing.
Apparently, in xapps-ignore.lst must be regexps.
Something like:^/bin/bash /usr/local/bin/desktop-session ^/bin/bash /usr/bin/devmonAnd grep call whithout -x
ps -U $(whoami) --no-headers -o args | grep -v -f xapps-ignore.lstHome directory can be $HOME in, say, xapps-ignore.lst.template and then simply
sed "s/\$HOME/$HOME/g" xapps-ignore.lst.template > xapps-ignore.lstWords are carried away by the wind...
September 1, 2021 at 4:15 pm #66209Member
zblsv
::Yet another useful info from ps:
ps -U $(whoami) -o start_time,etime,etimes,argsWords are carried away by the wind...
-
AuthorPosts
- You must be logged in to reply to this topic.