Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old 08-18-2025, 07:06 PM   #1
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
any interest in an *-env.txt file for setting env vars for Sigil

Hi All,

Given how much effort and how messy it is to set environment variables for macOS that actually get read when launching Sigil from the Finder or Panel or Drag and Drop, I have decided to borrow a page out of Kovid's calibre for macOS that enables a macos-env.txt file. This file would be kept in Sigil's Preferences folder and the user could use any text editor to set environment variables for use inside of Sigil that would be read by Sigil on startup.

The format is (one per line):

ENVIRONMENT_VARIABLE_NAME=VALUE

I have tested this and it seems to work well.

My question is do we want to make this feature available to all platforms?

Maybe with a win-env.txt, or a linux-env.txt (or unix-env.txt) so that any user on any platform could use any text editor to set and change Sigil environment variables?

If so, this would be an easy change.

Thoughts?

Last edited by KevinH; 08-18-2025 at 10:00 PM.
KevinH is offline   Reply With Quote
Old 08-18-2025, 07:29 PM   #2
retiredbiker
Evangelist
retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.retiredbiker ought to be getting tired of karma fortunes by now.
 
retiredbiker's Avatar
 
Posts: 451
Karma: 3886916
Join Date: May 2013
Location: Ontario, Canada
Device: Kindle KB, Oasis, Pop_Os!, Kobo Forma
I'm using Linux, and that would be very nice. I would use it.
retiredbiker is offline   Reply With Quote
Old 08-18-2025, 07:45 PM   #3
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,845
Karma: 169712582
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I agree that it would be a nice feature.
DNSB is offline   Reply With Quote
Old 08-18-2025, 09:02 PM   #4
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,679
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I say yes for Windows, too.
DiapDealer is online now   Reply With Quote
Old 08-18-2025, 10:02 PM   #5
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
Okay, I will tweak that routine to work on all platforms and push it to master.
KevinH is offline   Reply With Quote
Old 08-19-2025, 10:10 AM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
One other question ... Does or even can anyone ever share the same Sigil Prefs folder across platforms?

If not, then instead of platform specific file name like macos-env.txt, win-env.txt, etc, can we use just one file name like "env-vars.txt" for all platforms? It will make the code have fewer ifdefs.
KevinH is offline   Reply With Quote
Old 08-19-2025, 10:46 AM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,679
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I sure don't. I've never even tried it. I say keep it simple.
DiapDealer is online now   Reply With Quote
Old 08-19-2025, 11:51 AM   #8
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
Okay, that is what I did, so no ifdefs at all!

It uses one text file called "env-vars.txt" inside the root of the Sigil Preferences folder.

I modified it to use Utility::ReadUnicodeTextFile() so it should be able to automatically handle native Windows utf-16 text files as well as normal utf-8 text files, and should handle removing any BOM markers so nothing should interfere.

The format is (one per line):

ENVIRONMENT_VARIABLE_NAME=VALUE

both are treated as strings that are trimmed so no quotes are needed anyplace.

I tried to make this happen as early as possible after main() so that even Qt and Chrome EVs can be set into the env-vars.txt file properly. Note, that means this file is only read once on first startup of Sigil.

I have just pushed this to master. I will update the sigil-user-guide to reflect how this env-vars.txt can be used to make setting environment variables easier for everyone in the advanced topics chapter that lists all of our environment variables.

If anyone builds their own and uses Sigil or Qt/Chrome env vars, please give it a try and let me know if any issues happen.

Thanks


Update: I pushed the Sigil User Guide updates to its master. It will be ready when we do our next release (ie. 2.6.2) sometime down the road.

Last edited by KevinH; 08-19-2025 at 12:29 PM.
KevinH is offline   Reply With Quote
Old 08-19-2025, 12:18 PM   #9
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,679
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Great! This will come in handy for people who don't know how to set an environment variable. It will also ensure they don't have to set variables that could affect other programs without needing to create scripts to set variables and launch programs. I'm pretty sure QTextStream and QString both convert all line endings to \n in memory, right? No need to worry about \r\n.

Correct me if I'm wrong, but couldn't this approach also solve the custom .bdic location for PageEdit problem that we were discussing? Set the variable in the file and drop/copy dictionaries where you want?

Something in your recent pushes is failing the Linux CI build on GitHub (which uses our Python and Qt minimums), however.
DiapDealer is online now   Reply With Quote
Old 08-19-2025, 12:25 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,116
Karma: 60406498
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by KevinH View Post
One other question ... Does or even can anyone ever share the same Sigil Prefs folder across platforms?

If not, then instead of platform specific file name like macos-env.txt, win-env.txt, etc, can we use just one file name like "env-vars.txt" for all platforms? It will make the code have fewer ifdefs.
Even if we don't use multiple OS, some of us keep multiple computers with Sigil (and Calibre). This is a great way to keep them all on the came page or not mess with a borrowed computers env settings
theducks is offline   Reply With Quote
Old 08-19-2025, 12:33 PM   #11
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by DiapDealer View Post
I'm pretty sure QTextStream and QString both convert all line endings to \n in memory, right? No need to worry about \r\n.
It may, but we have always handled line endings ourselves. See Utility.cpp's ConvertLineEndingsand Normalize() routine. So either way, we are covered.

Quote:
Correct me if I'm wrong, but couldn't this approach also solve the custom .bdic location for PageEdit problem that we were discussing? Set the variable in the file and drop/copy dictionaries where you want?
Yes that should work. Great idea! We can document that in the PageEdit user's guide someplace.

Quote:
Something in your recent pushes is failing the Linux CI build on GitHub (which uses our Python and Qt minimums), however.
I will look into that? I would hope qputenv would exist all of the way back to Qt 6.4, but I will look into it.

Last edited by KevinH; 08-19-2025 at 12:59 PM.
KevinH is offline   Reply With Quote
Old 08-19-2025, 12:34 PM   #12
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
Quote:
Originally Posted by theducks View Post
Even if we don't use multiple OS, some of us keep multiple computers with Sigil (and Calibre). This is a great way to keep them all on the came page or not mess with a borrowed computers env settings
Good point. Thanks!
KevinH is offline   Reply With Quote
Old 08-19-2025, 12:56 PM   #13
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
Okay, it seems in Qt 6.4 and earlier, QDebug"s << operator did not understand std::strings. In later Qt versions that ability to work with std::strings was added. So I literally just had to add a static QString::fromStdString to convert it and old Qt QDebug is now happy.

So we should be good to go. Your minimum requirements Linux CI is really nice as it forces me to be honest!
KevinH is offline   Reply With Quote
Old 08-19-2025, 01:28 PM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,679
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Looks good! I don't know why I never thought of this sooner, but I'm updating the various CI builds to be able to be kick-started (and deployed) manually. Like we can do with the Linux AppImage CI. It's silly for us to have wait on 5 separate processes (not to mention sometimes having to do a pointless commit just to add [deploy] to the message) when we might want to just generate a beta installer based on the most recent commits.

Testing on Windows now. If all goes well, I'll add the same ability to the two macOS workflows.
DiapDealer is online now   Reply With Quote
Old 08-19-2025, 03:05 PM   #15
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,878
Karma: 6120478
Join Date: Nov 2009
Device: many
If anyone tries this with their own builds, please regrab from Sigil master now as my move to all platforms introduced a bug that has now been fixed.
KevinH is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
sigil does'nt load txt-files ikkethuis Sigil 1 01-11-2021 01:46 PM
Filename to File Tag and Setting File Dorectory anonymust Library Management 3 11-07-2015 07:42 PM
shebang problem "/usr/bin/env python2" klonuo Development 2 10-21-2011 11:08 AM
How can i convert HTML or txt file to EPUB file ? guguqiaqia ePub 7 05-28-2010 09:15 PM
Problem & fix to Windows dev env setup ShellShock Calibre 6 12-07-2008 10:13 AM


All times are GMT -4. The time now is 02:44 PM.


MobileRead.com is a privately owned, operated and funded community.