openbox{Fatdog & other}visually ID which desktop??(Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
jtwdyp
Posts: 137
Joined: Fri 04 Oct 2013, 10:48

openbox{Fatdog & other}visually ID which desktop??(Solved)

#1 Post by jtwdyp »

Thanks to Fatdog I've discovered that I actually "LIKE" using openbox. Almost more than E17... If I could {visually} see a major difference between the desktops then I think openbox would soon be my default "desktop*" in all my Linux installations.

* yeah, I know it's only a window manager as opposed to a full "DE".

I'd settle for an {all desktop} application that displayed the current desktop number or name in a bold 48pt font...

Anybody know how :?:
Last edited by jtwdyp on Thu 13 Mar 2014, 02:31, edited 1 time in total.
[color=brown][size=67]
--
JtWdyP

[/size][/color]

ProgRob
Posts: 67
Joined: Wed 13 Feb 2013, 12:39

#2 Post by ProgRob »

The easiest way would be to bind a key to show the client-list-combined-menu which shows you the desktops and the active windows within each. I have the a binding in my rc.xml file like:

Code: Select all

   <keybind key="C-A-2">
      <action name="ShowMenu">
        <menu>client-list-combined-menu</menu>
      </action>
    </keybind>
which puts up a useful menu when I press control-alt-2.

Otherwise the following command typed into a terminal:

Code: Select all

xprop -root _NET_CURRENT_DESKTOP
will display the number of the current desktop.

You can then combine this with gxmessage in a bash script like so:

Code: Select all

#!/usr/bin/bash
DESKTOPNUMBER=`xprop -root _NET_CURRENT_DESKTOP|tail -c 3`
gxmessage -borderless -center -font "serif bold 48" -buttons "Ok" -default "Ok" -timeout 2 -fg white -bg black "Desktop: $((DESKTOPNUMBER+1))"
This gives a message box with the current desktop number on it showing for 2 seconds (or less if you press Ok).

Of course it would be possible to do something even more sophisticated (e.g. have the desktop number appear in large letters at the centre of the screen) but that will take a little programming...

Hope that helps,
Rob

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#3 Post by RSH »

Deleted, reply not longer relevant.
Last edited by RSH on Wed 12 Mar 2014, 11:55, edited 1 time in total.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

Jasper

#4 Post by Jasper »

Hi RSH,

VarioMenu seems to work with Precise 5.6 and jwm, although I have "my own" Menu-selector-launcher made with instructions from a stu90/91 thread.

I also use SFS-Tray and Favorites (left click Menu), two jwm apps from seaside, together with other Menu apps including PupMenu from radky which is shown in the screen shot and can be used with jwm, openbox etc etc etc.

Blues Eyes is, I'm 99% sure, from CatDude.

My regards

ProgRob
Posts: 67
Joined: Wed 13 Feb 2013, 12:39

#5 Post by ProgRob »

I noticed that you ideally wanted a different wallpaper for each desktop. I found this solution on a Linux Mint forum which seems to work. I've tweaked it for Puppy. To get this to work you need to have something to set the wallpaper. I have used qiv which can be downloaded from the Ubuntu repos as I have dsiabled the Rox pinboard. I suspect that if you change the qiv line to: rox -p="$desktop_dir$1" it should work. Needs to be tested.

Anyhow, give this a go!

Code: Select all

#!/bin/bash
# Workspace desktop image switcher WDIS 1.0
# Script to change the desktop image when switching workspaces.
# Tested on Linux Mint 13 'cinnamon'
desktop_dir="/usr/share/backgrounds/" # full path to images directory; 
desktop_img[0]="default.jpg"
desktop_img[1]="tyson-skateboarding.jpg"
desktop_img[2]="sunset_jesse.jpg"
desktop_img[3]="squiggles.jpg"
# add more images if using more workspaces

setdesktop() {
   qiv -z "$desktop_dir$1"
}
xprop -root -spy _NET_CURRENT_DESKTOP | (
   while read -r; do
      desk=${REPLY:${#REPLY}-1:1}
      setdesktop ${desktop_img[$desk]}
   done
   )
Credit to garalou on the Linux Mint Forums


Cheers,
Rob

User avatar
jtwdyp
Posts: 137
Joined: Fri 04 Oct 2013, 10:48

#6 Post by jtwdyp »

ProgRob wrote:The easiest way would be to bind a key to show the client-list-combined-menu which shows you the desktops and the active windows within each.
- - - - - - - - -< s n i p STUFF >- - - - - - - - - -
which puts up a useful menu when I press control-alt-2.
Yeah, The thing is I'm trying to find out how to have something happen automatically on desktop change...

Otherwise the following command typed into a terminal:

Code: Select all

xprop -root _NET_CURRENT_DESKTOP
will display the number of the current desktop.
That piece of the puzzle is priceless! Thank you!
You can then combine this with gxmessage in a bash script like so:

Code: Select all

#!/usr/bin/bash
DESKTOPNUMBER=`xprop -root _NET_CURRENT_DESKTOP|tail -c 3`
gxmessage -borderless -center -font "serif bold 48" -buttons "Ok" -default "Ok" -timeout 2 -fg white -bg black "Desktop: $((DESKTOPNUMBER+1))"
I'm not real familiar with gxmessage, so I'm not sure... But it looks to me like that would still need to be called by conscious action. IE I have to remember to push the key bound to this script before it displays anything right?

If I could solve that part of the puzzle. I'd marry that priceless snippet of code you gave me above with a script more like this:

Code: Select all

case $(xprop -root _NET_CURRENT_DESKTOP) in
# # 	for Fatdog comment out the feh lines and uncomment the wallpaper lines
# 	*0) wallpaper $HOME/0bg/ChillyLickingGood2001.jpg;;
# 	*1) wallpaper $HOME/0bg/z_optic2.png;;
# 	*2) wallpaper $HOME/0bg/metruck.jpg;;
# 	*3) wallpaper $HOME/0bg/greydragon.png;;
# 	*4) wallpaper $HOME/0bg/ShiloWannaPlay0273.jpg;;
# 	*5) wallpaper $HOME/0bg/jungle.png;;
# # 	for Mageia comment out the wallpaper lines and uncomment the feh lines
	*0) feh  --bg-scale "$HOME/0bg/ChillyLickingGood2001.jpg";;
	*1) feh  --bg-scale "$HOME/0bg/z_optic2.png";;
	*2) feh  --bg-scale "$HOME/0bg/metruck.jpg";;
	*3) feh  --bg-scale "$HOME/0bg/greydragon.png";;
	*4) feh  --bg-scale "$HOME/0bg/ShiloWannaPlay0273.jpg";;
	*5) feh  --bg-scale "$HOME/0bg/jungle.png";;
esac
I just need to figure out how to get the action of switching desktop areas to call my script...
RSH wrote:So you actually LIKE Openbox? :P

Ok, please read carefully.

Try these two packages and you'll LOVE Openbox.

After installing these packages (Part1 = 1st, Part2 = 2nd) restart X Server.

It should work with gtkdialog 0.8.0 (gtkdialog4) but I recommend to use the latest version, which is currently 0.8.4 - I think.

After X has restarted, you'll have a desktop pager in system tray, that shows activated desktop as numerical sign (1, 2, 3 etc.pp). Centered on top of the screen you'll find the VarioMenu-Group Pager which shows activated desktop related to the VarioMenu-Group (like: Admin, Audio, Graphics, Office etc.pp). VarioMenu-Groups and openbox desktops are synchronized for the first 8 VM-Groups/OB-Desktops.

You can add more VM-Groups since Openbox is now setup to have 30 desktops available. So you can add up to 30 VM-Groups.
I'm thinking this is more complex than I'm hoping for...

My brain is used to working with 12 desktop areas. I set my keybindings to use <ctrl>+<F-key> and/or <ctrl>+<Tab> & <ctrl>+<shift>+<Tab> Getting away from the puppy/jwm <alt>+<Num> was why I bothered learning enough about Fatdog's openbox to start liking it...

I'm thinking I could set the initial background image by calling my script in ~/.config/openbox/autostart. Then if I can figure out how to add a second action that calls it to the bindings that switch my desktop... And if the first action would complete before the second action starts, then my script would be called right after the switch to a new desktop, right? I'm not real good with xml though so if anybody feels like giving an example I'd be grateful

Then all I'd have to do is hunt down and disable any desktop switching that doesn't use the keybindings...

Though I suppose there is little to be done about what if I click on a pager such as the one in whatever panel fatdog uses or the similar one in the lxpanel I added to Mageia's openbox package. Still, If I actually click on that instead of using my chosen keybindings, then I deserve to have a hiccup in the background change. Besides I can always fix it with a call to my script...
[color=brown][size=67]
--
JtWdyP

[/size][/color]

User avatar
jtwdyp
Posts: 137
Joined: Fri 04 Oct 2013, 10:48

#7 Post by jtwdyp »

ProgRob wrote:I noticed that you ideally wanted a different wallpaper for each desktop. I found this solution on a Linux Mint forum which seems to work. I've tweaked it for Puppy. To get this to work you need to have something to set the wallpaper. I have used qiv which can be downloaded from the Ubuntu repos as I have dsiabled the Rox pinboard. I suspect that if you change the qiv line to: rox -p="$desktop_dir$1" it should work. Needs to be tested.

Anyhow, give this a go!

Code: Select all

#!/bin/bash
# Workspace desktop image switcher WDIS 1.0
# Script to change the desktop image when switching workspaces.
# Tested on Linux Mint 13 'cinnamon'
desktop_dir="/usr/share/backgrounds/" # full path to images directory; 
desktop_img[0]="default.jpg"
desktop_img[1]="tyson-skateboarding.jpg"
desktop_img[2]="sunset_jesse.jpg"
desktop_img[3]="squiggles.jpg"
# add more images if using more workspaces

setdesktop() {
   qiv -z "$desktop_dir$1"
}
xprop -root -spy _NET_CURRENT_DESKTOP | (
   while read -r; do
      desk=${REPLY:${#REPLY}-1:1}
      setdesktop ${desktop_img[$desk]}
   done
   )
Credit to garalou on the Linux Mint Forums
If I'm reading this right, this assigns all the image filenames to an array, Then runs continuously , detecting the desktop change somehow... I'm guessing it's the -spy option to xprop? I don't know about qiv, And I don't want to mess around with rox. But I know the wallpaper command that came with Fatdog64-630 works, and in Mageia I can do it with feh And adapting this to those background setting commands sounds better than messing with my keybindings...

It will take a while for me to have the time again. (my lady has started to threaten to pour water on my keyboards again...) But I will eventually test this idea and post the results. Thanks!
[color=brown][size=67]
--
JtWdyP

[/size][/color]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#8 Post by RSH »

ProgRob wrote:I noticed that you ideally wanted a different wallpaper for each desktop.
No, I don't wanted it ideally.

I got it already working and running here, but I think it's just not included completely in the development package above (can't say it for sure).

If you want to check, if it will work by this package, just activate its option in the VarioMenu-GUI (2nd tab), close it by menu entry (not by close button of window!) and switch the OB-desktop/VM-group.

Make sure the wallpaper/s given in the .rc.file/s is/are existing!
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
RSH
Posts: 2397
Joined: Mon 05 Sep 2011, 14:21
Location: Germany

#9 Post by RSH »

Jasper wrote:Hi RSH,

VarioMenu seems to work with Precise 5.6 and jwm, although I have "my own" Menu-selector-launcher made with instructions from a stu90/91 thread.

I also use SFS-Tray and Favorites (left click Menu), two jwm apps from seaside, together with other Menu apps including PupMenu from radky which is shown in the screen shot and can be used with jwm, openbox etc etc etc.

Blues Eyes is, I'm 99% sure, from CatDude.

My regards
Hi.

Though I don't like dogs very much, I must say: nice wallpaper!

Got any links for the applications you mentioned (not the PupMenu, the others)?

The menu looks interesting.
[b][url=http://lazy-puppy.weebly.com]LazY Puppy[/url][/b]
[b][url=http://rshs-dna.weebly.com]RSH's DNA[/url][/b]
[url=http://murga-linux.com/puppy/viewtopic.php?t=91422][b]SARA B.[/b][/url]

User avatar
CatDude
Posts: 1563
Joined: Wed 03 Jan 2007, 17:49
Location: UK

#10 Post by CatDude »

Hi

@ Jasper
Jasper wrote:..Blues Eyes is, I'm 99% sure, from CatDude.
I did use that image in one of my GRUB gfxmenu files, but it is not mine.
You can find it in various sizes online, here for example

CatDude
.
[img]http://www.smokey01.com/CatDude/.temp/sigs/acer-futile.gif[/img]

User avatar
jtwdyp
Posts: 137
Joined: Fri 04 Oct 2013, 10:48

#11 Post by jtwdyp »

ProgRob wrote:I noticed that you ideally wanted a different wallpaper for each desktop. I found this solution on a Linux Mint forum which seems to work. I've tweaked it for Puppy.
I Know I said my previous example worked on fatdog. But actually, I'd only tested the "wallpaper path/imagefile" part of it there. I've just discovered that neither of my Fatdog64-630 installations have xprop installed...

Anybody know what pet includes it???

But about the openbox background switcher...

This almost does it for me on my Mageia installation:

Code: Select all

#!/bin/bash
# Workspace desktop image switcher WDIS 1.0
# Script to change the desktop image when switching workspaces.
# Tested on Linux Mint 13 'cinnamon'
# desktop_dir="/usr/share/backgrounds/" # full path to images directory; 
desktop_dir="$HOME/0bg/" # full path to images directory; 
desktop_img[0]="ChillyLickingGood2001.jpg"
desktop_img[1]="z_optic2.png"
desktop_img[2]="metruck.jpg"
desktop_img[3]="greydragon.png"
desktop_img[4]="ShiloWannaPlay0273.jpg"
desktop_img[5]="BlueStone.png"
desktop_img[6]="DragonlySkyscapes-014.jpg"
desktop_img[7]="DragonlySkyscapes-016.jpg"
desktop_img[8]="FantaScene-006.jpg"
desktop_img[9]="DragonlySkyscapes-018.jpg"
desktop_img[10]="DragonlySkyscapes-019.jpg"
desktop_img[11]="jungle.png"
# add more images if using more workspaces

setdesktop() {
# => 	test
#    display "$desktop_dir$1"
# =>    	Mageia
    feh  --bg-scale "$desktop_dir$1"
# =>    	fatdog
#    wallpaper "$desktop_dir$1"
}
xprop -root -spy _NET_CURRENT_DESKTOP | (
   while read -r; do
      desk=${REPLY:${#REPLY}-1:1}
      setdesktop ${desktop_img[$desk]}
   done
   )

It fails on the last 2 of my 12 desktop areas... Obviously because 10 & 11 are 2 digit numbers... And as best as I can make out, this:

Code: Select all

      desk=${REPLY:${#REPLY}-1:1}
only extracts the last "1" char from the $REPLY string... I could probably figure out how to make it extract the last 2 but then the first 10 values would be invalid... I'll have to figure out some conditional branching logic for that.

But could somebody explain that line to me a little better?

I mean what does the last :1 do? Using it as an example I figured out how to make this:

Code: Select all

 a="badgoodcrap" && b=${a:${#a}-8} && c=${b:${#b}-4} && echo $c 
say "crap" But I can't figure out how to make it say good. :?:

I'm thinking that one or the other of these would solve the array problem for the last two desktops, but would likely break the first 10...

Code: Select all

      desk=${REPLY:${#REPLY}-2:1}
      desk=${REPLY:${#REPLY}-2:2}
I won't get to play with the PC I installed openbox to until later... But I'm guessing the latter... in which case perhaps something like:

Code: Select all

      case $(desk=${REPLY:${#REPLY}-2:2}) in
      	[0-9][0-9]) setdesktop ${desktop_img[$desk]};;
      	*)desk=${REPLY:${#REPLY}-1:1};
      	setdesktop ${desktop_img[$desk]};;
      esac
[color=brown][size=67]
--
JtWdyP

[/size][/color]

User avatar
jtwdyp
Posts: 137
Joined: Fri 04 Oct 2013, 10:48

#12 Post by jtwdyp »

jtwdyp wrote:But could somebody explain that line to me a little better?

I mean what does the last :1 do? Using it as an example I figured out how to make this:

Code: Select all

 a="badgoodcrap" && b=${a:${#a}-8} && c=${b:${#b}-4} && echo $c 
say "crap" But I can't figure out how to make it say good. :?:
Seems either of these will do it...

Code: Select all

a="badgoodcrap" && b=${a:${#a}-8:4} && echo $b
a="badgoodcrap" && b=${a:${#a}-8} && c=${b:${#b}-8:4} && echo $c

I'm thinking that one or the other of these would solve the array problem for the last two desktops, but would likely break the first 10...

Code: Select all

      desk=${REPLY:${#REPLY}-2:1}
      desk=${REPLY:${#REPLY}-2:2}
I won't get to play with the PC I installed openbox to until later... But I'm guessing the latter... in which case perhaps something like:

Code: Select all

      case $(desk=${REPLY:${#REPLY}-2:2}) in
      	[0-9][0-9]) setdesktop ${desktop_img[$desk]};;
      	*)desk=${REPLY:${#REPLY}-1:1};
      	setdesktop ${desktop_img[$desk]};;
      esac
Not quite... but this one does the job!

Code: Select all

#based on an original script posted to linuxmint forum by garolou 
#[url]http://forums.linuxmint.com/viewtopic.php?p=672189#p672189[/url]
# Script to change the desktop image when switching workspaces.
# Tested on Mageia release 3 (Official) for x86_64 Kernel 3.10.28-desktop-1.mga3
# desktop_dir="/usr/share/backgrounds/" # full path to images directory; 
desktop_dir="$HOME/0bg/" # full path to images directory; 
desktop_img[0]="ChillyLickingGood2001.jpg"
desktop_img[1]="z_optic2.png"
desktop_img[2]="metruck.jpg"
desktop_img[3]="greydragon.png"
desktop_img[4]="ShiloWannaPlay0273.jpg"
desktop_img[5]="snapshot-dragon-storm.png"
desktop_img[6]="DragonlySkyscapes-014.jpg"
desktop_img[7]="DragonlySkyscapes-016.jpg"
desktop_img[8]="FantaScene-006.jpg"
desktop_img[9]="DragonlySkyscapes-018.jpg"
desktop_img[10]="DragonlySkyscapes-019.jpg"
desktop_img[11]="jungle.png"
# add more images if using more workspaces

setdesktop() {
# => 	test
#    display "$desktop_dir$1"
# =>    	Mageia
    feh  --bg-scale "$desktop_dir$1"
# =>    	fatdog
#    wallpaper "$desktop_dir$1"
}
xprop -root -spy _NET_CURRENT_DESKTOP | (
   while read -r; do
       desk=${REPLY:${#REPLY}-2:2}
       case $desk in
      		[0-9][0-9]) setdesktop ${desktop_img[$desk]};;
		*)desk=${REPLY:${#REPLY}-1:1};
		setdesktop ${desktop_img[$desk]};;
       esac
   done
   )
[color=brown][size=67]
--
JtWdyP

[/size][/color]

Post Reply