Skip to content

Commit

Permalink
Resolves dropby
Browse files Browse the repository at this point in the history
  • Loading branch information
samlane-ma committed Oct 19, 2023
1 parent d030837 commit e75c94a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
7 changes: 3 additions & 4 deletions budgie-dropby/budgie_dropby.py
Expand Up @@ -108,8 +108,8 @@ def __init__(self, uuid):
self.uuid = uuid
self.connect("destroy", Gtk.main_quit)
app_path = os.path.dirname(os.path.abspath(__file__))
user = os.environ["USER"]
self.copytrigger = "/tmp/" + user + "_dropby_icon_copy"
self.tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
self.copytrigger = os.path.join(self.tmp_path, ".dropby_icon_copy")
self.copying = False
self.winpath = os.path.join(app_path, "dropover")
self.box = Gtk.EventBox()
Expand Down Expand Up @@ -188,8 +188,7 @@ def set_iconactive(self, arg1, arg2, arg3, event):

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

def start_dropover(self):
try:
Expand Down
4 changes: 2 additions & 2 deletions budgie-dropby/checkonwin
Expand Up @@ -19,8 +19,8 @@ should have received a copy of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>.
"""

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


try:
Expand Down
4 changes: 2 additions & 2 deletions budgie-dropby/copy_flash
Expand Up @@ -87,8 +87,8 @@ def copy(source, targetdir):


# get targeted path
user = os.environ["USER"]
cptrigger = "/tmp/" + user + "_dropby_icon_copy"
tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
cptrigger = os.path.join(tmp_path, ".dropby_icon_copy")
try:
target = subprocess.check_output([
"/usr/bin/zenity", "--file-selection", "--directory",
Expand Down
9 changes: 4 additions & 5 deletions budgie-dropby/dropover
Expand Up @@ -62,10 +62,10 @@ class WatchVolumes:
app_path = os.path.dirname(os.path.abspath(__file__))
self.copyscript = os.path.join(app_path, "copy_flash")
self.start_timer = os.path.join(app_path, "checkonwin")
user = os.environ["USER"]
self.timer = "/tmp/" + user + "_keepdropbywin"
self.tmp_path = os.getenv("XDG_RUNTIME_DIR") if "XDG_RUNTIME_DIR" in os.environ else os.getenv("HOME")
self.timer = os.path.join(self.tmp_path, ".keepdropbywin")
# setup watching trigger (uncomment below lines if)
infofile = Gio.File.new_for_path("/tmp")
infofile = Gio.File.new_for_path(self.tmp_path)
monitor = infofile.monitor(Gio.FileMonitorFlags.NONE, None)
monitor.connect("changed", self.actonfile)
# setup watching applet presence
Expand Down Expand Up @@ -100,8 +100,7 @@ class WatchVolumes:

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

0 comments on commit e75c94a

Please sign in to comment.