Do not store all files in XDG_CONFIG_HOME.
* The new env variable `$VIMB_SELECTION` is set to the current selected text
whenever a `shellcmd` is run #592.
* Allow to push link url to queue by `<S-LeftMouse>` #610.
+### Changed
+* Modes some files from `$XDG_CONFIG_HOME/vimb` into `$XDG_DATA_HOME/vimb` #582.
+ Following files are affected `bookmark`, `closed`, `command`, `config`,
+ `cookies.db`, `history`, `queue` and `search`.
+ Existing files could be moved to the new location by
+ ```
+ mv $XDG_CONFIG_HOME/vimb/{bookmark,closed,command,cookies.db,history,queue,search} \
+ $XDG_DATA_HOME/vimb
+
+ # and same for existing profiles
+ mkdir $XDG_DATA_HOME/vimb/<ProfileName>
+ mv $XDG_CONFIG_HOME/vimb/<ProfileName>/{bookmark,closed,command,cookies.db,history,queue,search} \
+ $XDG_DATA_HOME/vimb/<ProfileName>
+ ```
### Fixed
* Fixed ignored last line in config file if this line did not end in newline.
* Fixed crash in normal_focus_last_active (Thanks to Maxime Coste)
.I config
Configuration file to set WebKit setting, some GUI styles and keybindings.
.TP
+.I scripts.js
+This file can be used to run user scripts, that are injected into every page
+that is opened.
+.TP
+.I style.css
+File for userdefined CSS styles.
+These file is used if the config variable `stylesheet' is enabled.
+.PD
+.RE
+.
+.TP
+.IR $XDG_DATA_HOME/vimb[/PROFILE]
+Directory for runtime data.
+If executed with \fB-p \fIPROFILE\fR parameter, data files are written from
+this subdirectory.
+.
+.RS
+.PD 0
.I cookies.db
Sqlite cookie storage.
This file will not be touched if option \-\-incognito is set.
.I search
This file holds the history of search queries.
This file will not be touched if option \-\-incognito is set.
-.TP
-.I scripts.js
-This file can be used to run user scripts, that are injected into every page
-that is opened.
-.TP
-.I style.css
-File for userdefined CSS styles.
-These file is used if the config variable `stylesheet' is enabled.
.PD
.RE
-.TP
-There are also some sample scripts installed together with Vimb under
-PREFIX/share/vimb/examples.
-.
.
.SH ENVIRONMENT
.TP
{
WebKitWebContext *ctx;
WebKitCookieManager *cm;
- char *path;
+ char *path, *dataPath;
- /* prepare the file pathes */
+ /* Prepare files in XDG_CONFIG_HOME */
path = util_get_config_dir();
if (vb.configfile) {
} else {
vb.files[FILES_CONFIG] = g_build_filename(path, "config", NULL);
}
+ vb.files[FILES_SCRIPT] = g_build_filename(path, "scripts.js", NULL);
+ vb.files[FILES_USER_STYLE] = g_build_filename(path, "style.css", NULL);
+ g_free(path);
- /* Setup those files that are use multiple time during runtime */
+ /* Prepare files in XDG_DATA_HOME */
+ dataPath = util_get_data_dir();
if (!vb.incognito) {
- vb.files[FILES_CLOSED] = g_build_filename(path, "closed", NULL);
- vb.files[FILES_COOKIE] = g_build_filename(path, "cookies.db", NULL);
+ vb.files[FILES_CLOSED] = g_build_filename(dataPath, "closed", NULL);
+ vb.files[FILES_COOKIE] = g_build_filename(dataPath, "cookies.db", NULL);
}
- vb.files[FILES_BOOKMARK] = g_build_filename(path, "bookmark", NULL);
- vb.files[FILES_QUEUE] = g_build_filename(path, "queue", NULL);
- vb.files[FILES_SCRIPT] = g_build_filename(path, "scripts.js", NULL);
- vb.files[FILES_USER_STYLE] = g_build_filename(path, "style.css", NULL);
+ vb.files[FILES_BOOKMARK] = g_build_filename(dataPath, "bookmark", NULL);
+ vb.files[FILES_QUEUE] = g_build_filename(dataPath, "queue", NULL);
- vb.storage[STORAGE_HISTORY] = file_storage_new(path, "history", vb.incognito);
- vb.storage[STORAGE_COMMAND] = file_storage_new(path, "command", vb.incognito);
- vb.storage[STORAGE_SEARCH] = file_storage_new(path, "search", vb.incognito);
- g_free(path);
+ vb.storage[STORAGE_HISTORY] = file_storage_new(dataPath, "history", vb.incognito);
+ vb.storage[STORAGE_COMMAND] = file_storage_new(dataPath, "command", vb.incognito);
+ vb.storage[STORAGE_SEARCH] = file_storage_new(dataPath, "search", vb.incognito);
+ g_free(dataPath);
/* Use seperate rendering processed for the webview of the clients in the
* current instance. This must be called as soon as possible according to
return path;
}
+/**
+ * Retrieves the data directory path according to current used profile.
+ * Returned string must be freed.
+ */
+char *util_get_data_dir(void)
+{
+ char *path = g_build_filename(g_get_user_data_dir(), PROJECT, vb.profile, NULL);
+ create_dir_if_not_exists(path);
+
+ return path;
+}
+
/**
* Retrieves the length bytes from given file.
*
unsigned int max_lines);
char *util_file_pop_line(const char *file, int *item_count);
char *util_get_config_dir(void);
+char *util_get_data_dir(void);
char *util_get_file_contents(const char *filename, gsize *length);
gboolean util_file_set_content(const char *file, const char *contents);
char **util_get_lines(const char *filename);