LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 04-23-2020, 12:33 PM   #1
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Rep: Reputation: Disabled
Gedit Problem


All,

Created this script, to open a list of last files edited:
Code:
#! /bin/bash
#  Script to edit a list of files with GEDIT!
#  Should be in the APP Launcher
#
#  Run with cmd: bash /Scripts/FileMgmt/gedit-last.sh

srcfil=/Scripts/FileMgmt/gedit-list.txt
fillin=''
while IFS= read -r line; do
   fillin="$fillin$line "
done <$srcfil
gedit $fillin
Using this input file:
Code:
# Gedit multifile input file gedit-list.txt
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Spiritual/kng/How_to_Pray.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Spiritual/kng/Who_is_God.html
/home/files/Dropbox/Corporate/Comps_&_Holds/Dads_HC/Blog_Posts/HealthCare&You2.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref01.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref02.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref03.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref04.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref05.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref06.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref07.html
/home/files/Dropbox/Books_Authoring/Blogs_&_Domains/Truth-Party/TP_Ref08.html
I works except for two problems:
  1. It open a new GEDIT window without the profile settings, not in the current open GEDIT session. This is not usable as it is all white, with no contrast, so I can not see the text,
  2. It reads the comment line, which it must ignore.
I'm sure ignoring the comment line is simple if I just look the the '#' 1st character.

I did not find anything about determining if GEDIT exist and opening the file list in new tabs.

Cheers!

TBNK
 
Old 04-23-2020, 01:04 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,861

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
probably: https://askubuntu.com/questions/7567...les-from-nauti
 
Old 04-23-2020, 09:19 PM   #3
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Comment line fixed

All,

Added the test on "fstchr" so now skipping the comment line.

Code:
#! /bin/bash
#  Script to edit a list of files with GEDIT!
#  Should be in the APP Launcher
#
#  Run with cmd: bash /Scripts/FileMgmt/gedit-last.sh

srcfil=/Scripts/FileMgmt/gedit-list.txt
fillin=''
while IFS= read -r line; do
	fstchr=${line:0:1}
	if [[ "$fstchr" == "#" ]]; then
		continue
	fi
   fillin="$fillin$line "
done <$srcfil
# echo $fillin
gedit $fillin
 
Old 04-23-2020, 09:22 PM   #4
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
pan64,

Don't understand anything at/in the link you sent. I'm on KDE not Nautulis!

Cheers!

TBNK

PS:

Running cmd:
Code:
ps -A | grep gedit
Shows:
Quote:
3106 ? 00:04:14 gedit
Which is my currently open gedit session.

I assume my script should run this cmd and then change/add some option to assign the new tabs/sessions to this window, instead of a new one! Running cmd: "man gedit" did not show me any options that seemed like it/they would work.

Cheers!

Last edited by TBotNik; 04-23-2020 at 09:31 PM.
 
Old 04-24-2020, 02:25 PM   #5
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
pan64,

Don't understand anything at/in the link you sent. I'm on KDE not Nautulis!
If you are on KDE then why are you using gedit ? You can use Kate which is a multi-file editor instead. Kate is superior to gedit. If you are having problems with gedit profile settings and you are using KDE you should try Kate instead.

Quote:
It open a new GEDIT window without the profile settings, not in the current open GEDIT session.
With KDE's Kate it adds new files specified at the command line such as $ kate new_file to the current open Kate window if there is one. I just tried this as I am on KDE also.

Quote:
I assume my script should run this cmd and then change/add some option to assign the new tabs/sessions to this window, instead of a new one! Running cmd: "man gedit" did not show me any options that seemed like it/they would work.
Kate does what you want automatically by default so there would be no need for scripts running ps commands or the like.


Also very importantly you never mentioned in your first post that you were using KDE. How would pan64 or anyone else know this ?

Nautilus is the file browser for Gnome. You wouldn't be "on Nautilus". You would be using a desktop environment such as Gnome which uses Nautilus as its file browser. Since you only mentioned gedit many would assume you were using Gnome or something related. There is no need for the exclamation marks.

Last edited by tofino_surfer; 04-24-2020 at 03:03 PM.
 
3 members found this post helpful.
Old 04-24-2020, 05:46 PM   #6
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by tofino_surfer View Post
If you are on KDE then why are you using gedit ? You can use Kate which is a multi-file editor instead. Kate is superior to gedit. If you are having problems with gedit profile settings and you are using KDE you should try Kate instead.



With KDE's Kate it adds new files specified at the command line such as $ kate new_file to the current open Kate window if there is one. I just tried this as I am on KDE also.



Kate does what you want automatically by default so there would be no need for scripts running ps commands or the like.


Also very importantly you never mentioned in your first post that you were using KDE. How would pan64 or anyone else know this ?

Nautilus is the file browser for Gnome. You wouldn't be "on Nautilus". You would be using a desktop environment such as Gnome which uses Nautilus as its file browser. Since you only mentioned gedit many would assume you were using Gnome or something related. There is no need for the exclamation marks.
tofino_surfer,

I always appreciate any inputs, but sometimes people respond with an opinion, not actual help, thus it is with your response.

Yes Kate is available but has no options I need and totally unveiwable as no "CONTRAST" and therefore I hate it. GEDIT has been my trusted and totally usable for all apps I engage, so sticking to it. Besides would run into the same problem with KATE, as I already have. Yes I had to customize GEDIT to my liking, but I did that over 15 years, adding plugins, configuring fonts/sizes, colors, background, etc. etc.

As for KATE doing what I want, total BS. What happens is I have 5-50 files open editing them and the edit session crashes. I'm building a separate "SAVE" bash script that records all GEDIT open/editing files, into the source file being used in this current script, so when I crash I have this as a restore. KATE as GEDIT does not keep a list of the last files edited, so has the same problem.

Your opinion is KATE is better, I disagree and so did not help with my problem.

Nautilus is a browser for losers as any every Linux user knows the only "SECURE" browser is FireFox, since 1998 and the IISC declared that use of any other browser the user is responsible for all losses and only FireFox shifts that legal blame back to the writer/programmer of any data breaching or phishing scripts. Firefox is now totally self secure, but use to need addons of: NoScript, AD_Block Plus and Ghostery to be secure.

You have to be a half wit to be using anything but Firefox as you have 0 protection using any other browser. That goes for Chrome also as Google is the #! promoter and violator of data breaches and phishing and has all their illegal viruses built right into Chrome.

Yes cmdline on Kubuntu is the same as Ubuntu, except for a list of addons and extras that come with KDE and the users separately install as apps/scripts he/she normally uses.

Cheers!

TBNK
 
Old 04-24-2020, 05:57 PM   #7
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Can’t help with either gedit or Kedit ... here’s an opinion....

I use SciTE on both Windows and Linux. Very customizable, excellent documentation. I’ve never had a need to open 50 files at once, but I have been as high as 20-25.

Last edited by scasey; 04-24-2020 at 05:58 PM.
 
Old 04-24-2020, 06:50 PM   #8
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
OP: Nautilus isn’t a browser, it’s the file manager in the Gnome DE. Before you lash out, do your homework.
 
1 members found this post helpful.
Old 04-24-2020, 11:04 PM   #9
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
Nautilus is a browser for losers as any every Linux user knows the only "SECURE" browser is FireFox,
You apparently don't understand what a file manager or file browser is and think it is a "web browser". Nautilus which is now called the very boring "Gnome files" is the equivalent of the Dolphin file manager in KDE.

File managers which may be called file browsers are very different from web browsers.

https://en.wikipedia.org/wiki/GNOME_Files

From the page above the "browser" interface of this file manager is described. The "browser" interface is often the default which is why file manager applications are sometimes called "file browsers"

Code:
In the version included with GNOME 2.6, Nautilus switched to a spatial interface.[7] Several Linux distributions have made "browser" mode the default. The "classic" interface is still available:

    By a filing cabinet shaped icon.
    By an option in the "Edit -> Preferences -> Behavior" menu in Nautilus.
    In a folder's context menu.
    By using the "--browser" switch when started by a command via a launcher or shell.
Quote:
You have to be a half wit to be using anything but Firefox as you have 0 protection using any other browser. That goes for Chrome also as Google is the #! promoter and violator of data breaches and phishing and has all their illegal viruses built right into Chrome.
How is this not an opinion and much more of a rant. All because you don't understand the difference between the file manager application of a desktop environment and a web browser.

Quote:
Your opinion is KATE is better, I disagree and so did not help with my problem.
The main problem you mentioned was that you could not open a list of files into an existing editor window with gedit. Such functionality is built into Kate. If you have an open Kate window and inside a script you open multiple files with a command they will all appear in the existing window. So on the basis of built-in functionality Kate is more powerful. gedit may have more plugins and be more configurable however it doesn't do what you want or you would not have made this post.

Nowhere in your first post did you mention that you found Kate unsuitable for other reasons or that you had ever tried Kate. No one replying to your post could have known this. I therefore did help with the problem you asked.

Quote:
As for KATE doing what I want, total BS.
It solves the main problem in your post so you could be less rude.

Quote:
What happens is I have 5-50 files open editing them and the edit session crashes.
From https://unix.stackexchange.com/quest...r-kate-crashes

Code:
Being one of the Kate Developers, I can explain the workflow like this:

When Kate or the system crashes, you lose all text buffers that were never saved. However, if you are working on a text file (that exists as file on disk), a swap file is created next to the file, called .filename.kate-swp. Now, if Kate starts again, Kate searches for these swap files. If found it replicates all edit actions that were recorded in this swap file, and your data is fully restored.

Rule of thumb: Always (and I repeat: always) work with files, not unsaved text buffers. That is good practice with everything you do on a Computer.
 
2 members found this post helpful.
Old 04-25-2020, 04:33 AM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Well, it's definitely not the first time this user lashed out like that.
Asking questions, getting angry at being pointed to a flaw in the original premise, not listening to answers.
Emotion getting in the way.
I wish it wasn't such a common scenario on the interwebz.

Quote:
Originally Posted by TBotNik View Post
Created this script, to open a list of last files edited:
I know of several code/plaintext editors that do this ootb, regardless of DE.
I'm not going to tell you which though because you'll just lash out again, saying editor XYZ is "not what you want".
 
2 members found this post helpful.
Old 04-27-2020, 10:00 PM   #11
TBotNik
Member
 
Registered: May 2016
Location: Greenville, TX
Distribution: Kubuntu 18.04
Posts: 796

Original Poster
Rep: Reputation: Disabled
All,

When I added the script to the launcher menu it ran perfectly. I even closed out all GEDIT sessions, hit the launcher and comes up in the default GEDIT with my custom profile and adds all files to the tabs.

So marked this solved!

Cheers!

TBNK
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Changing shortcut keys for gedit using /.config/gedit/accels has no impact in program charlemagne-is-my-son Linux - Software 1 12-16-2014 08:16 AM
Gnome 3, Gedit 3.0.5, when I open file with gedit, it created one more unneeded tab Mr. Alex Linux - Software 1 06-18-2011 07:58 AM
problem saving with gEdit and then viewing with Notepad VicRic Linux - Newbie 6 07-24-2007 08:30 PM
gedit problem installing warzone jbumgar Linux - Newbie 4 09-07-2006 10:18 AM
Text selection problem with Gedit liaohaohui Linux - Software 0 11-18-2004 04:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 07:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration