Application doesnt open in desired workspace

87 views
Skip to first unread message

Ami Mehta

unread,
Mar 8, 2013, 1:42:24 AM3/8/13
to devil...@googlegroups.com
What does my code do?
Once the user selects the application, the desired extensions, he is asked if he wants to switch that application to another workspace/viewport then he enters the viewport number. Now using devilspie we switch that application to the specified viewport.

Problem:
1. if the viewport number > 4, then the application is opening in any random viewport.
2. when i selected viewport 1 for the first application it opened in viewport 1, however when i re ran the code and i entered viewport  1 again for another application, it dint open in viewport 1 instead in viewport 2.
3. even after uninstalling compiz, set_workspace doesnt work.
4. does the workspace/viewport start counting from 0 or 1?

Note: ubuntu version - 10.04; devilspie -latest

CODE:
#Finding the current user=loc
pwd > location.txt
while read line
do
loc=$line
done <location.txt

#Create .devilspie folder
mkdir $loc/.devilspie

#Create .aisance folder
mkdir $loc/.aisance

#Ask for application name=app
flag=0
while [ $flag -eq 0 ]
do
app=$(zenity --list --title="Aisance" --text="Select The Application" --radiolist --column "Pick" --column "Application Name" TRUE "OpenOffice" FALSE "ImageViewer");
if [ $? = 1 ];
then exit
fi
if [ "$app" = "OpenOffice" ] || [ "$app" = "ImageViewer" ]
then
flag=1
    if [ "$app" = "OpenOffice" ]
    then
        ans=$(zenity  --list  --text "Choose the extensions for search" --checklist  --column "Pick" --column "options" TRUE "doc" TRUE "docx" FALSE "odt" FALSE "txt" --separator=" "); #echo $ans
        app2="OpenOffice.org 3.2"

    else
        ans=$(zenity  --list  --text "Choose the extensions for search" --checklist  --column "Pick" --column "options" TRUE "jpg" TRUE "bmp" FALSE "gif" FALSE "png" FALSE "jpeg" --separator=" " ); #echo $ans
        app2="Eye of GNOME Image Viewer"
    fi
else
    zenity --error\
      --window-icon="info" \
      --text="Enter a valid Application Name"
    --no-cancel
    flag=0
fi
done


#Ask for workspace=work
f=0
while [ $f -eq 0 ]
do
choice=$(zenity --list --title="Aisance" --text="Do you want to switch to a new workspace?" --radiolist --column "Pick" --column "Choice" TRUE "Yes" FALSE "No");
if [ $? = 1 ];
then exit
fi
if [ "$choice" = "No" ]
    then #echo "Dont Shift" #and jump to shortcut creation
    echo ' ' > $HOME/.devilspie/rules.ds
    break
else    
    work=$(zenity --entry --title="Aisance" --text="Enter Workpspace Number")
    echo ' (if (is (application_name) "'"$app2"'") (set_viewport '$work') (maximize))' > $HOME/.devilspie/rules.ds
    f=1
fi
done

#Finding the required files
for word in $ans
do
find -name "*.$word" > $loc/.aisance/linkfile_$app.txt
cut -c 2- $loc/.aisance/linkfile_$app.txt > $loc/.aisance/linkfile2_$app.txt
grep -v /Trash/ $loc/.aisance/linkfile2_$app.txt > $loc/.aisance/linkfile_$app.txt
#Creating the shortcuts
while read line
do
mkdir $loc/Desktop/$word
IFS='\' #handling broken links
a=$loc$line
ln -s $a $loc/Desktop/$word
done <$loc/.aisance/linkfile_$app.txt
done

#calling the application
echo $app2

if [ "$app2" = "Eye of GNOME Image Viewer" ]
then
eog
fi

if [ "$app2" = "OpenOffice.org 3.2" ]
then
oowriter
fi

#calling devilspie
devilspie

Andreas Rönnquist

unread,
Mar 8, 2013, 5:25:23 AM3/8/13
to devil...@googlegroups.com
> What does my code do?
> Once the user selects the application, the desired extensions, he is
> asked if he wants to switch that application to another
> workspace/viewport then he enters the viewport number. Now using
> devilspie we switch that application to the specified viewport.
>
> Problem:
> 1. if the viewport number > 4, then the application is opening in any
> random viewport.
> 2. when i selected viewport 1 for the first application it opened in
> viewport 1, however when i re ran the code and i entered viewport 1
> again for another application, it dint open in viewport 1 instead in
> viewport 2. 3. even after uninstalling compiz, set_workspace doesnt
> work. 4. does the workspace/viewport start counting from 0 or 1?
>
> Note: ubuntu version - 10.04; devilspie -latest
>
> #calling devilspie
> devilspie
>

This (and the fact that you use .ds files) tells me that you are using
the original Devilspie and not devilspie2. That isn't supported in this
google group.

You are welcome with questions if you are having problems with
devilspie2.

best regards
-- Andreas Rönnquist
gus...@gusnan.se
Reply all
Reply to author
Forward
0 new messages