How change opening position XED 3.2.2

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
NoHo Hank
Level 5
Level 5
Posts: 562
Joined: Wed Jun 29, 2022 6:03 am

How change opening position XED 3.2.2

Post by NoHo Hank »

hI we would like to know how to let XED 3.2.2 open in the left upper corner instead of in the middle of the screen. We use LM 21.3 Cinnnamon.
Thanks.
Last edited by LockBot on Wed Aug 02, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Demand technology that serves us - https://peoplevsbig.tech/
None of Your Business https://noyb.eu/en
JosephM
Level 6
Level 6
Posts: 1463
Joined: Sun May 26, 2013 6:25 pm

Re: How change opening position XED 3.2.2

Post by JosephM »

You can't really do this for xed specifically but in Cinnamon you can go to the window setting, under the behavior tab, and change the placement from center to automatic. That's probably about the best you'll get without a bunch of workarounds.
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
rickNS
Level 9
Level 9
Posts: 2974
Joined: Tue Jan 25, 2011 11:59 pm

Re: How change opening position XED 3.2.2

Post by rickNS »

JosephM wrote: Fri Feb 03, 2023 9:53 am You can't really do this for xed specifically but in Cinnamon you can go to the window setting, under the behavior tab, and change the placement from center to automatic. That's probably about the best you'll get without a bunch of workarounds.
I have figured it out, just don't know if OP would want to go through that much trouble to save a second of click, and drag ?

EDIT, found a better, easier way thanks to @vimes666 in this thread, viewtopic.php?f=213&t=390908&p=2291606#p2291606

1, in File manager, got to /usr/share
2, Right click on Applications folder, and open as root.
3, Scroll down to Text editor.
4, Right click on it and select open with, and choose text editor.
5, Scroll down to the line
Exec=xed %U
6, Change it to look like this;
Exec=bash -c 'xed & sleep 1; wmctrl -r Unsaved Document 1 -e '0,0,0,-1,-1''
(Copy and paste that as the last character is not a double quote, but 2 single quotes.)
7, Save the file, and close the elevated window
Done

**************************************************
FORGET All from here, and down.

Basically a wmctrl command, specifically, xed & sleep 1; wmctrl -r Unsaved Document 1 -e '0,0,0,-1,-1'

Even better from a terminal perspective is adding nohup, and exit at the end, Anyway what I don't understand is why the command works from a terminal, but modifying the xed.desktop file (or adding a keyboard shortcut, or new menu item) it does not work ?

So to make it work;
1, make a /bin folder in your home, so /home/<USERNAME>/bin
1a, log out back in so it will be added to PATH.
2, in that ~/bin folder, create a text file named txt-ed, put that command xed & sleep 1; wmctrl -r Unsaved Document 1 -e '0,0,0,-1,-1' in it.
2a, save, and close
3, right click on that file, select Properties, then Permissions, and check the box Allow executing file as program, and close
4, Now create a Menu item for it.
Right click on Menu, click Configure, click Menu, and click Open the Menu editor
Click Accessories on the left side, click New Item on thee right
Fill in the blanks;
Name; txt-ed
Command; /home/USERNAME/bin/txt-ed (obviously use real Username there)
Comment; open xed top left

OPTIONAL; you can click on the rocket icon, and choose something else if you like. I did and choose Applications category, scrolled down to "accessories-text-editor-symbolic, click select.
ksnip230203-1129.jpg
Otherwise, click OK, Close, and "X" out
Done,

Now when you click txt-ed in the menu it will open xed in the top left corner.

PS, This is just one more reason I use MATE DE.
I think I got all typos ?
Last edited by rickNS on Fri Feb 03, 2023 8:57 pm, edited 1 time in total.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
JosephM
Level 6
Level 6
Posts: 1463
Joined: Sun May 26, 2013 6:25 pm

Re: How change opening position XED 3.2.2

Post by JosephM »

This is what I was meaning by doing workarounds :)
PS, This is just one more reason I use MATE DE.
I'm curious, as pretty much only use Mate for testing things real quick, how is this different there?
When I give opinions, they are my own. Not necessarily those of any other Linux Mint developer or the Linux Mint project as a whole.
rickNS
Level 9
Level 9
Posts: 2974
Joined: Tue Jan 25, 2011 11:59 pm

Re: How change opening position XED 3.2.2

Post by rickNS »

JosephM wrote: Fri Feb 03, 2023 12:29 pm This is what I was meaning by doing workarounds :)
PS, This is just one more reason I use MATE DE.
I'm curious, as pretty much only use Mate for testing things real quick, how is this different there?
Yeah I know what you meant by workaround. Lots of times people want something, but won't put in much effort to accomplish it.

MATE can use compiz as window manager where window placement is quite easy.
I guess in this exact case MATE is not different, but related, it is much easier (well quicker access anyway) to modify a programs' launcher, all you need to do is right click it in the menu, and "Edit Properties" (actually I think IIRC you can do that in xfce as well) where as in Cinnamon you have to got to /usr/share/applications, and edit the *.desktop file. Maybe there is another way, conversely I don't use Cinnamon...much, only in VMs to do this sort of testing thing.
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
NoHo Hank
Level 5
Level 5
Posts: 562
Joined: Wed Jun 29, 2022 6:03 am

Re: How change opening position XED 3.2.2

Post by NoHo Hank »

rickNS wrote: Fri Feb 03, 2023 11:32 am I have figured it out, just don't know if OP would want to go through that much trouble to save a second of click, and drag ?

EDIT, found a better, easier way thanks to @vimes666 in this thread, viewtopic.php?f=213&t=390908&p=2291606#p2291606
Hi rickNS, thanks for looking into this. It works so far that Xed is opening in the left corner. But only an empty window appears. No txt to read! and when writing a new file it stays empty, named: 'unsaved'.
Something isn't going to plan. Could you have a closer look please?

"to save a second of click, and drag"
Multiply that by 100+ times as i need to do so. (-*
Demand technology that serves us - https://peoplevsbig.tech/
None of Your Business https://noyb.eu/en
mikeflan
Level 17
Level 17
Posts: 7143
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: How change opening position XED 3.2.2

Post by mikeflan »

rickNS addressed the original post parameters. Please explain the additional parameters you would like to apply.
You want to open 1 existing xed file named ________ or you want to open 100 existing xed files which reside in _______ directory or something else.
rickNS
Level 9
Level 9
Posts: 2974
Joined: Tue Jan 25, 2011 11:59 pm

Re: How change opening position XED 3.2.2

Post by rickNS »

NoHo Hank wrote: Sat Feb 04, 2023 10:13 pm
Hi rickNS, thanks for looking into this. It works so far that Xed is opening in the left corner. But only an empty window appears. No txt to read! and when writing a new file it stays empty, named: 'unsaved'.
Something isn't going to plan. Could you have a closer look please?
EDIT; SEE EDIT BELOW, Solved for sure.

I see what you mean.
When opening existing text documents it does not show the content...or name.
It is apparently because of the missing %U in the command, however when adding it in, then the move no longer works.

You will probably want to change it back to the way it was so you can access your text files. The slightly bad news is you now can't do that the same way you changed it the first time, because you can't seem to open existing text files properly with xed.

To get back to where you were before you will need to open the file with nano,
sudo nano /usr/share/applications/xed.desktop

Scroll down with arrow keys to the Exec line again and change it back to the way it was originally.
Exec=xed %U
Press Ctrl + O (write Out changes)
Then Enter (confirm file name)
Then Ctrl + X (exit nano)

Side note, I don't know why writing a new file did not work for you, it did OK here.

And I know why it does not work for existing text files, the wmctrl command matches the title of the window, and I used "Unsaved Document 1" as the match, there is no way to write the command to somehow "match" all the files you have. Also I've noticed you can use PIDs, but they tend to change. I will look into "if" you can get it to match just the "xed" program name...

EDIT, Solved, and I'll give the credit to linuxconfig.org for pointing me in the right direction
https://forum.linuxconfig.org/t/how-to- ... ation/2267

The Exec= line should read;

Exec=bash -c 'xed %U & sleep 1; wmctrl -r :ACTIVE: -e '0,0,0,-1,-1''

It will now work from the menu to open a new document or will open an existing text document by clicking on it, both in the upper left.
Only small bug, seems it won't work with files with spaces in their names.
My test was with;
bs-file
bs-file 2
both with different content

bs-file opened and moved as expected, bs-file 2, opened in the center position, and 'strangely' displayed contents of bs-file.

But as 'proper' filenames should NOT have spaces anyway, I'm done with this.
As stated I prefer the MATE DE
Mint 20.0, and 21.0 MATE on Thinkpads, 3 X T420, T450, T470, and X200
User avatar
NoHo Hank
Level 5
Level 5
Posts: 562
Joined: Wed Jun 29, 2022 6:03 am

Re: How change opening position XED 3.2.2

Post by NoHo Hank »

rickNS wrote: Sun Feb 05, 2023 8:16 am As stated I prefer the MATE DE
Hi rickNS, sorry i couldn't reply earlier. This forum seems to notedown the ip adress so when logging in from different locations that became impossible:

Code: Select all

The submitted form was invalid. Try submitting again.

You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA below.
Some outdated reactions i wrote earleir BUT COULDN'T SENT:
I noticed i couldn't change back the command so i did a timeshift to get back to previous situation. Sorry should have mentioned that.

So i understand it is not possible to make XED open files in another spot on the screen then the default one?

@mikeflan
Everyday i need to copy 10+ different texts into 10+ different new xed files. That makes in only 10 days already 100+ original xed files.
NoHo Hank


i wil try the new command although i find Nano difficult to work with. Thanks a lot again.
NH H
Demand technology that serves us - https://peoplevsbig.tech/
None of Your Business https://noyb.eu/en
mikeflan
Level 17
Level 17
Posts: 7143
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: How change opening position XED 3.2.2

Post by mikeflan »

i understand it is not possible to make XED open files in another spot on the screen then the default one?
Not true. This works for me:

Code: Select all

xed text; wmctrl -r text -e '0,0,0,-1,-1'
User avatar
NoHo Hank
Level 5
Level 5
Posts: 562
Joined: Wed Jun 29, 2022 6:03 am

Re: How change opening position XED 3.2.2

Post by NoHo Hank »

mikeflan wrote: Wed Feb 08, 2023 11:23 am
i understand it is not possible to make XED open files in another spot on the screen then the default one?
Not true. This works for me:

Code: Select all

xed text; wmctrl -r text -e '0,0,0,-1,-1'
Really? When i open an existing xed files it annoyingly opens in the middl of the screen...
using a special command in terminal doesnt make anything easier
:wink:
Demand technology that serves us - https://peoplevsbig.tech/
None of Your Business https://noyb.eu/en
Locked

Return to “Beginner Questions”