Skip to content

Commit e75c94a

Browse files
committed
Resolves dropby
1 parent d030837 commit e75c94a

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

budgie-dropby/budgie_dropby.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def __init__(self, uuid):
108108
self.uuid = uuid
109109
self.connect("destroy", Gtk.main_quit)
110110
app_path = os.path.dirname(os.path.abspath(__file__))
111-
user = os.environ["USER"]
112-
self.copytrigger = "/tmp/" + user + "_dropby_icon_copy"
111+
self.tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
112+
self.copytrigger = os.path.join(self.tmp_path, ".dropby_icon_copy")
113113
self.copying = False
114114
self.winpath = os.path.join(app_path, "dropover")
115115
self.box = Gtk.EventBox()
@@ -188,8 +188,7 @@ def set_iconactive(self, arg1, arg2, arg3, event):
188188

189189
def create_windowtrigger(self, *args):
190190
if not self.check_winexists():
191-
user = os.environ["USER"]
192-
open("/tmp/" + user + "_call_dropby", "wt").write("")
191+
open(os.path.join(self.tmp_path, ".call_dropby"), "wt").write("")
193192

194193
def start_dropover(self):
195194
try:

budgie-dropby/checkonwin

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ should have received a copy of the GNU General Public License along with this
1919
program. If not, see <https://www.gnu.org/licenses/>.
2020
"""
2121

22-
dropby_user = os.environ["USER"]
23-
timer = "/tmp/" + dropby_user + "_keepdropbywin"
22+
tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
23+
timer = os.path.join(tmp_path, ".keepdropbywin")
2424

2525

2626
try:

budgie-dropby/copy_flash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def copy(source, targetdir):
8787

8888

8989
# get targeted path
90-
user = os.environ["USER"]
91-
cptrigger = "/tmp/" + user + "_dropby_icon_copy"
90+
tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
91+
cptrigger = os.path.join(tmp_path, ".dropby_icon_copy")
9292
try:
9393
target = subprocess.check_output([
9494
"/usr/bin/zenity", "--file-selection", "--directory",

budgie-dropby/dropover

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ class WatchVolumes:
6262
app_path = os.path.dirname(os.path.abspath(__file__))
6363
self.copyscript = os.path.join(app_path, "copy_flash")
6464
self.start_timer = os.path.join(app_path, "checkonwin")
65-
user = os.environ["USER"]
66-
self.timer = "/tmp/" + user + "_keepdropbywin"
65+
self.tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
66+
self.timer = os.path.join(self.tmp_path, ".keepdropbywin")
6767
# setup watching trigger (uncomment below lines if)
68-
infofile = Gio.File.new_for_path("/tmp")
68+
infofile = Gio.File.new_for_path(self.tmp_path)
6969
monitor = infofile.monitor(Gio.FileMonitorFlags.NONE, None)
7070
monitor.connect("changed", self.actonfile)
7171
# setup watching applet presence
@@ -100,8 +100,7 @@ class WatchVolumes:
100100

101101
def actonfile(self, arg1, arg2, arg3, event):
102102
# ok, let's replace once dbus is a fact
103-
user = os.environ["USER"]
104-
trigger = "/tmp/" + user + "_call_dropby"
103+
trigger = os.path.join(self.tmp_path, ".call_dropby")
105104
if all([
106105
event == Gio.FileMonitorEvent.CREATED,
107106
os.path.exists(trigger)

0 commit comments

Comments
 (0)