Skip to content

Commit 588cbe6

Browse files
committed
Resolves 2 - 2.1 / 2.2
- resolves 2.1 - resolves 2.2
1 parent e75c94a commit 588cbe6

4 files changed

Lines changed: 21 additions & 26 deletions

File tree

‎budgie-wpreviews/src/previews_creator.vala‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,8 @@ namespace create_previews {
5656
if (wnck_scr == null) return; // usually if not run on X11
5757
gdk_scr = Gdk.Screen.get_default();
5858
if (gdk_scr == null) return; // usually if there is no display
59-
string user = Environment.get_user_name();
60-
var tmp = Environment.get_tmp_dir() + "/";
61-
previewspath = tmp.concat(user, "_window-previews");
59+
string tmpdir = Environment.get_variable("XDG_RUNTIME_DIR") ?? Environment.get_variable("HOME");
60+
previewspath = GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmpdir, ".windows-previews");
6261
update_winlist();
6362
wnck_scr.window_opened.connect(update_winlist);
6463
wnck_scr.window_opened.connect(refresh_new);

‎budgie-wpreviews/src/previews_daemon.vala‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ namespace NewPreviews {
3131
bool showtooltips;
3232
bool allapps;
3333
Gtk.Button[] currbuttons;
34-
string user;
3534
File triggerdir;
3635
File nexttrigger;
3736
File allappstrigger;
@@ -661,25 +660,25 @@ namespace NewPreviews {
661660
allworkspaces = previews_settings.get_boolean("allworkspaces");
662661
showtooltips = previews_settings.get_boolean("showtooltips");
663662
});
664-
var tmp = Environment.get_tmp_dir() + "/";
663+
string tmp = Environment.get_variable("XDG_RUNTIME_DIR") ?? Environment.get_variable("HOME");
665664
triggerdir = File.new_for_path(tmp);
666665
allappstrigger = File.new_for_path(
667-
tmp.concat(user, "_prvtrigger_all")
666+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_all")
668667
);
669668
allappstriggerhotc = File.new_for_path(
670-
tmp.concat(user, "_prvtrigger_all_hotcorner")
669+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_all_hotcorner")
671670
);
672671
currapptriggerhotc = File.new_for_path(
673-
tmp.concat(user, "_prvtrigger_curr_hotcorner")
672+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_curr_hotcorner")
674673
);
675674
nexttrigger = File.new_for_path(
676-
tmp.concat(user, "_nexttrigger")
675+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".nexttrigger")
677676
);
678677
previoustrigger = File.new_for_path(
679-
tmp.concat(user, "_previoustrigger")
678+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".previoustrigger")
680679
);
681680
triggercurrent = File.new_for_path(
682-
tmp.concat(user, "_prvtrigger_current")
681+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_current")
683682
);
684683
// start with a clean plate please
685684
cleanup();
@@ -711,9 +710,8 @@ namespace NewPreviews {
711710
}
712711

713712
public static void main (string[] args) {
714-
user = Environment.get_user_name();
715-
var tmp = Environment.get_tmp_dir() + "/";
716-
previewspath = tmp.concat(user, "_window-previews");
713+
string tmp = Environment.get_variable("XDG_RUNTIME_DIR") ?? Environment.get_variable("HOME");
714+
previewspath = GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".windows-previews");
717715
try {
718716
File file = File.new_for_commandline_arg (previewspath);
719717
file.make_directory ();

‎budgie-wpreviews/src/previews_triggers.vala‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,26 @@ namespace previews_triggers {
3737

3838
public static void main (string[] args) {
3939

40-
// user
41-
string user = Environment.get_user_name();
40+
// user dir
41+
string tmp = Environment.get_variable("XDG_RUNTIME_DIR") ?? Environment.get_variable("HOME");
4242
// files
43-
var tmp = Environment.get_tmp_dir() + "/";
4443
File allappstrigger = File.new_for_path(
45-
tmp.concat(user, "_prvtrigger_all")
44+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_all")
4645
);
4746
File nexttrigger = File.new_for_path(
48-
tmp.concat(user, "_nexttrigger")
47+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".nexttrigger")
4948
);
5049
File previoustrigger = File.new_for_path(
51-
tmp.concat(user, "_previoustrigger")
50+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".previoustrigger")
5251
);
5352
File triggercurrent = File.new_for_path(
54-
tmp.concat(user, "_prvtrigger_current")
53+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_current")
5554
);
5655
File allappstriggerhotc = File.new_for_path(
57-
tmp.concat(user, "_prvtrigger_all_hotcorner")
56+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_all_hotcorner")
5857
);
5958
File currapptriggerhotc = File.new_for_path(
60-
tmp.concat(user, "_prvtrigger_curr_hotcorner")
59+
GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmp, ".prvtrigger_curr_hotcorner")
6160
);
6261

6362
File trg = nexttrigger;

‎budgie-wpreviews/src/separate_shot.vala‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ namespace fixpreviews {
3434

3535
private void make_prvpath () {
3636
// make previews path
37-
string user = Environment.get_user_name();
38-
var tmp = Environment.get_tmp_dir() + "/";
39-
previewspath = tmp.concat(user, "_window-previews");
37+
string tmpdir = Environment.get_variable("XDG_RUNTIME_DIR") ?? Environment.get_variable("HOME");
38+
previewspath = GLib.Path.build_path(GLib.Path.DIR_SEPARATOR_S, tmpdir, ".windows-previews");
4039

4140
try {
4241
File file = File.new_for_commandline_arg (previewspath);

0 commit comments

Comments
 (0)