You are not logged in.

#1 2012-12-04 06:45:39

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

[Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

Notice: A recent update to xfce4-terminal added some changes and changed the name it is invoked by (I assume to avoid the confusion of which DE it was a part of...) "terminal" was a bit too general for the name IMHO for the app... but now it is called with "xfce4-terminal". if running this script and you notice it doesn't start like it did before then that's more than likely why. You can either re-copy the script here where I've included the needed changes for those who've updated OR edit the script to change "terminal" to "xfce4-terminal" and "--hide-toolbars" to "--hide-toolbar" under the TERMOPTS= variable...

This was something I really wrote for myself then decided hey why not Someone may find it usefull so I expanded it a bit to a lazy version that creates a config file in home for you and sources your configurations from it. This one has more comments... To use it simply mark it executable...

chmod a+x /path/to/wallterm.sh

and add it to your startup applications to be applied at boot as normal user.
for the lazy one just run it once from any terminal and it will create a config file in your home named .wallterm.cfg
edit that file to your preferences and test it.
depends on:
wmctrl
terminal(the xfce terminal) or gnome-terminal
It can very easily be configured for another terminal that supports setting its windowname when started.
Note: I don't expect much traction or any kind of compliments for this. It was really my personal response to frustration dealing with devilspie. Plus I didn't care too much for another daemon running on my netbook when the window properties only need to be set once. All this really does is run an infinite while loop waiting for grep to catch the windows name as set when the terminal was started through the output of "wmctrl -l" then executing the wmctrl commands to set its properties once found and break the loop exiting the script. leaves me with a terminal fixed to my desktop. both gnome-terminal and the XFCE terminal have transparency support in their menus and the scrollbar can be disabled as well.
I'll likely update the wiki entry  to include only the working parts of this script as a template for those using reading it. 

#!/bin/bash
#For further info on the main commands used here consult the man pages
#for "wmctrl" and/or "terminal"(this may be different if you wish to use 
#another terminal instead of the Gnome or XFCE terminal)

#No reason to run initially as root...
if [[ $USER = root ]] ; then exit 1 ; fi

USRCFG=/home/"$USER"/.wallterm.cfg

if [[ -f $USRCFG ]] ; then
	source "$USRCFG"
else
	echo "#Wallterm configuration"	            > "$USRCFG"
	echo "#Give a name to the terminal window" >> "$USRCFG"
	echo "TITLE="       			   >> "$USRCFG"
	echo "#HxW size given in # of charactors"  >> "$USRCFG"
	echo "DIMENSIONS="			   >> "$USRCFG"
	echo "#X+Y position given in pixels"	   >> "$USRCFG"
	echo "POSITION=" 			   >> "$USRCFG"
	echo "Please edit $USRCFG before running wallterm"
	exit 1
fi

#"wmctrl" options for setting the window as a wallpaper.

opt1="-r "$TITLE" -b add,below,sticky"
opt2="-r "$TITLE" -b add,skip_taskbar,skip_pager"

#If you use a different terminal emulator you can edit these options or
#configure it through other mean and change any of the lines 44-49 to reflect 
#those chamges
TERMOPTS="--hide-borders --hide-toolbar --hide-menubar --title=$TITLE"

#checks if USRCFG has been edited. Otherwise exiting with 
if [[ -z $DIMENSIONS || -z $POSITION ]] || [[ -z $TITLE ]] ; then
	echo "wallterm has not been configured! Please edit wallterminal before running wallterm."
	exit 1
fi

#Uncomment only 1 of the 6 lines below if desiring different options
#if using gnome-terminal just change "terminal" to "gnome-terminal"(both support
#the same options listed in TERMOPTS and here 
xfce4-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &
#xfce4-terminal $TERMOPTS --maximize &
#xfce4-terminal $TERMOPTS --fullscreen &
#gnome-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &
#gnome-terminal $TERMOPTS --maximize &
#gnome-terminal $TERMOPTS --fullscreen &

#This repeatedly evaluates if wmctrl can see the windows name as set with 
#the opened terminals builtin options. Be sure the TITLE was set properly. 
while true 
do
	if [[ "$(wmctrl -l | grep -o "$TITLE")" = $TITLE ]] ; then 
		wmctrl $opt1 && wmctrl $opt2
		echo 'done!'
		break
	fi
done

...And the much simpler version that you simply edit TITLE, DIMENSIONS and POSITION in. 

#!/bin/bash
#Give a name to the terminal window.
TITLE=""
#HxW size given in # of charactors. Example: 25x60
DIMENSIONS=
#X+Y position given in pixels. Example: 100+200
POSITION=
TERMOPTS="--hide-borders --hide-toolbar --hide-menubar --title=$TITLE"

if [[ -z $DIMENSIONS || -z $POSITION ]] || [[ -z $TITLE ]] ; then
	echo "wallterm has not been configured! Please edit this script before running it."
	exit 1
fi

xfce4-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &
#gnome-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &

opt1="-r "$TITLE" -b add,below,sticky"
opt2="-r "$TITLE" -b add,skip_taskbar,skip_pager"

while true 
do
	if [[ "$(wmctrl -l | grep -o "$TITLE")" = $TITLE ]] ; then 
		wmctrl $opt1 && wmctrl $opt2
		echo 'done!'
		break
	fi
done

Last edited by Thme (2013-01-02 18:07:41)


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#2 2012-12-04 09:11:47

oliver
Member
Registered: 2007-12-12
Posts: 448

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

nice - thanks for posting.  Works on openbox too

Offline

#3 2012-12-04 13:00:18

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

The wmctrl man page states:
"wmctrl is a command that can be used to interact with an X Window manager that is compatible with the EWMH/NetWM specification."
So it may also work with many other window managers provided you have a terminal(XCFE, Gnome or another terminal) that supports the actions mentioned/used in my post/script.


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#4 2012-12-09 13:40:29

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

I'm getting an error whilst trying to use this:

./wallterm.sh: line 55: unexpected EOF while looking for matching `"'
./wallterm.sh: line 61: syntax error: unexpected end of file

I opened the file in vim and went to line 55, but I didn't see anything strange that might have caused that. I manually replaced the double quotes to see if I was copying another kind of double quotes, but that did nothing. Any suggestions?

Thanks,
Dragos

Offline

#5 2012-12-09 13:43:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,445
Website

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

That'd be from this line.  It needs a closing quotes on the echo.

echo "#XxY position given in pixels	   >> "$USRCFG"
echo "#XxY position given in pixels"	   >> "$USRCFG"

Last edited by Trilby (2012-12-09 13:43:53)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2012-12-09 14:10:28

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

Trilby wrote:

That'd be from this line.  It needs a closing quotes on the echo.

echo "#XxY position given in pixels	   >> "$USRCFG"
echo "#XxY position given in pixels"	   >> "$USRCFG"

Appreciate Noticing the typo... edited it... Ohh something else I missed in my comments fixing that too...


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#7 2012-12-09 14:26:02

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

Editing the config doesn't appear to change the size of the desktop window. It can be resized manually after it's been placed, but the config doesn't seem to affect the output.

For example. I set the pixel resolution option to "1440x900" and the character size to the same (It should have been 144x41). It took up 1/4 of my screen and was positioned at the bottom left hand corner.

Last edited by dragos240 (2012-12-09 14:30:32)

Offline

#8 2012-12-11 00:41:17

dragos240
Member
Registered: 2009-05-23
Posts: 189

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

Any idea why this might be happening?

Offline

#9 2012-12-16 19:08:43

Thme
Member
From: Raleigh NC
Registered: 2012-01-22
Posts: 105

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

Oops had to reread that. OK the top one had a typo in the setting's example.
the example for setting the position uses X+Y instead of XxY. Understandably that could easily confuse. I corrected it. Also note that The size uses dimensions set in number of characters while position is used for offsetting the terminal. If you wanted the terminal in say the center of the screen you'd use the position settings to offset it from the top right corner towards where you'd want the windows to be placed. If you still can't set the size of the terminal try this from a shell:

$ terminal --geometry=30x10

And see if you get a small terminal window. If not then it may be related to your window manager.
If all else doesn't work try the simpler script below in my main post. The settings are configured from it since it is such a small part of the script that actually does the work.

Last edited by Thme (2012-12-16 19:36:56)


"Hidden are the ways for those who pass by, for light is perished and darkness comes into being." Nephthys:
Ancient Egyptian Coffin Texts

Offline

#10 2014-10-29 02:47:15

sickpuppy
Member
Registered: 2014-09-30
Posts: 4

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

This thread doesn't seem to be active anymore but it's referenced by the wiki so I'll post my little glitch. The window this script creates still shows up on the taskbar \ in xfce 4.10 despite the following option:

"-r "$TITLE" -b add,skip_taskbar,skip_pager"

However I got it to work by referring to the window by its "numerical window ID" using the -i option.  I suppose this has to do with some updates to xfce since the script was written.  If I can mod the script to use the ID I'll post it here but I'm a scripting n00b so it may not happen.

Offline

#11 2014-10-29 04:04:34

sickpuppy
Member
Registered: 2014-09-30
Posts: 4

Re: [Bash]Set terminal as a wallpaper script for XFCE/Gnome. NO devilspie

This works:  (basically just grep twice to extract ID from wmctrl -l output, sed would probably work better but I can't figure out)

#!/bin/bash
#For further info on the main commands used here consult the man pages
#for "wmctrl" and/or "terminal"(this may be different if you wish to use 
#another terminal instead of the Gnome or XFCE terminal)

#No reason to run initially as root...
if [[ $USER = root ]] ; then exit 1 ; fi

USRCFG=/home/"$USER"/.wallterm.cfg

if [[ -f $USRCFG ]] ; then
	source "$USRCFG"
else
	echo "#Wallterm configuration"	            > "$USRCFG"
	echo "#Give a name to the terminal window" >> "$USRCFG"
	echo "TITLE="       			   >> "$USRCFG"
	echo "#HxW size given in # of charactors"  >> "$USRCFG"
	echo "DIMENSIONS="			   >> "$USRCFG"
	echo "#X+Y position given in pixels"	   >> "$USRCFG"
	echo "POSITION=" 			   >> "$USRCFG"
	echo "Please edit $USRCFG before running wallterm"
	exit 1
fi

#"wmctrl" options for setting the window as a wallpaper.

opt1="-b add,below,sticky"
opt2="-b add,skip_taskbar,skip_pager"

#If you use a different terminal emulator you can edit these options or
#configure it through other mean and change any of the lines 44-49 to reflect 
#those chamges
TERMOPTS="--hide-borders --hide-toolbar --hide-menubar --title=$TITLE"

#checks if USRCFG has been edited. Otherwise exiting with 
if [[ -z $DIMENSIONS || -z $POSITION ]] || [[ -z $TITLE ]] ; then
	echo "wallterm has not been configured! Please edit wallterminal before running wallterm."
	exit 1
fi

#Uncomment only 1 of the 6 lines below if desiring different options
#if using gnome-terminal just change "terminal" to "gnome-terminal"(both support
#the same options listed in TERMOPTS and here 
xfce4-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &
#xfce4-terminal $TERMOPTS --maximize &
#xfce4-terminal $TERMOPTS --fullscreen &
#gnome-terminal $TERMOPTS --geometry=$DIMENSIONS+$POSITION &
#gnome-terminal $TERMOPTS --maximize &
#gnome-terminal $TERMOPTS --fullscreen &

#This repeatedly evaluates if wmctrl can see the windows name as set with 
#the opened terminals builtin options. Be sure the TITLE was set properly. 
while true 
do
	if [[ "$(wmctrl -l | grep -o "$TITLE")" = $TITLE ]] ; then 
		ID="$(wmctrl -l | grep "$TITLE" | grep -o ^[[:alnum:]]*)"
		wmctrl -i -r $ID $opt1 && wmctrl -i -r $ID $opt2
		echo 'done!'
		break
	fi
done

Offline

Board footer

Powered by FluxBB