1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

Add option to change location of cache dir.

-cache-dir

Fixes: #769
This commit is contained in:
Dave Davenport 2019-02-08 20:43:53 +01:00
parent 94ebd7e635
commit 52204a527c
7 changed files with 32 additions and 9 deletions

View file

@ -156,4 +156,6 @@ Settings config = {
.combi_hide_mode_prefix = FALSE, .combi_hide_mode_prefix = FALSE,
.matching_negate_char = '-', .matching_negate_char = '-',
.cache_dir = NULL,
}; };

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "ROFI\-THEME\-SELECTOR" "1" "February 2018" "" "" .TH "ROFI\-THEME\-SELECTOR" "1" "May 2018" "" ""
. .
.SH "NAME" .SH "NAME"
\fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR \fBrofi\-theme\-selector\fR \- Preview and apply themes for \fBrofi\fR

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "ROFI" "1" "January 2019" "" "" .TH "ROFI" "1" "February 2019" "" ""
. .
.SH "NAME" .SH "NAME"
\fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement \fBrofi\fR \- A window switcher, application launcher, ssh dialog and dmenu replacement
@ -311,6 +311,12 @@ Filter the list by setting text in input bar to \fIfilter\fR
Load an alternative configuration file\. Load an alternative configuration file\.
. .
.P .P
\fB\-cache\-dir\fR \fIfilename\fR
.
.P
Directory that is used to place temporary files, like history\.
.
.P
\fB\-scroll\-method\fR \fImethod\fR \fB\-scroll\-method\fR \fImethod\fR
. .
.P .P

View file

@ -175,6 +175,11 @@ Filter the list by setting text in input bar to *filter*
Load an alternative configuration file. Load an alternative configuration file.
`-cache-dir` *filename*
Directory that is used to place temporary files, like history.
`-scroll-method` *method* `-scroll-method` *method*
Select the scrolling method. 0: Per page, 1: continuous. Select the scrolling method. 0: Per page, 1: continuous.

View file

@ -181,6 +181,9 @@ typedef struct
gboolean combi_hide_mode_prefix; gboolean combi_hide_mode_prefix;
char matching_negate_char; char matching_negate_char;
/** Cache directory. */
char *cache_dir;
} Settings; } Settings;
/** Global Settings structure. */ /** Global Settings structure. */
extern Settings config; extern Settings config;

View file

@ -776,13 +776,6 @@ int main ( int argc, char *argv[] )
g_free ( base_name ); g_free ( base_name );
} }
TICK (); TICK ();
// Get the path to the cache dir.
cache_dir = g_get_user_cache_dir ();
if ( g_mkdir_with_parents ( cache_dir, 0700 ) < 0 ) {
g_warning ( "Failed to create cache directory: %s", g_strerror ( errno ) );
return EXIT_FAILURE;
}
// Create pid file path. // Create pid file path.
const char *path = g_get_user_runtime_dir (); const char *path = g_get_user_runtime_dir ();
@ -883,6 +876,18 @@ int main ( int argc, char *argv[] )
parse_keys_abe ( bindings ); parse_keys_abe ( bindings );
// Get the path to the cache dir.
cache_dir = g_get_user_cache_dir ();
if ( config.cache_dir != NULL ) {
cache_dir = config.cache_dir;
}
if ( g_mkdir_with_parents ( cache_dir, 0700 ) < 0 ) {
g_warning ( "Failed to create cache directory: %s", g_strerror ( errno ) );
return EXIT_FAILURE;
}
/** dirty hack for dmenu compatibility */ /** dirty hack for dmenu compatibility */
char *windowid = NULL; char *windowid = NULL;
if ( !dmenu_mode ) { if ( !dmenu_mode ) {

View file

@ -218,6 +218,8 @@ static XrmOption xrmOptions[] = {
"Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT }, "Hide the prefix mode prefix on the combi view.", CONFIG_DEFAULT },
{ xrm_Char, "matching-negate-char", { .charc= &config.matching_negate_char }, NULL, { xrm_Char, "matching-negate-char", { .charc= &config.matching_negate_char }, NULL,
"Set the character used to negate the matching. ('\\0' to disable)", CONFIG_DEFAULT }, "Set the character used to negate the matching. ('\\0' to disable)", CONFIG_DEFAULT },
{ xrm_String, "cache-dir", { .str = &config.cache_dir }, NULL,
"Directory where history and temporary files are stored.", CONFIG_DEFAULT },
}; };
/** Dynamic array of extra options */ /** Dynamic array of extra options */