-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
if [[ $1 == --exit ]]; then | ||
killall TermPlug | ||
else | ||
open -g -a /Applications/TermPlug.app "$1" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
rm -rf build | ||
xcodebuild build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
rsync -rltp -vh --delete build/Release/TermPlug.app/ /Applications/TermPlug.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from ranger.api.commands import * | ||
import os | ||
import shutil | ||
|
||
|
||
class toggle_termplug(Command): | ||
""" | ||
:toggle_termplug | ||
""" | ||
|
||
def execute(self): | ||
p = not self.fm.settings["_termplug"] | ||
self.fm.settings["_termplug"] = p | ||
self.fm.execute_console(f"termplug {'%f' if p else ''}") | ||
status = f"termplug {'active' if p else 'off'}" | ||
self.fm.notify(status, duration=4) | ||
|
||
|
||
class termplug(Command): | ||
""" | ||
:termplug | ||
""" | ||
|
||
def execute(self): | ||
do_preview = self.fm.settings["_termplug"] | ||
termplug = shutil.which("termplug") | ||
try: | ||
f = self.rest(1) | ||
if not do_preview: | ||
self.fm.execute_console(f"shell -s termplug --exit") | ||
elif not termplug: | ||
self.fm.notify(f"termplug script not found") | ||
elif os.path.isfile(f): | ||
self.fm.notify(f"preview {f}") | ||
self.fm.execute_console(f"shell -s termplug '{f}'") | ||
except Exception as e: | ||
self.fm.notify(e) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import ranger.api | ||
import os | ||
import sys | ||
|
||
old_hook_init = ranger.api.hook_init | ||
|
||
|
||
def hook_init(fm): | ||
def on_move(signal): | ||
if fm.thisfile and fm.settings["_termplug"] and signal.new: | ||
f = signal.new.path | ||
fm.execute_console(f"termplug {f}") | ||
|
||
fm.settings["_termplug"] = False | ||
fm.signal_bind("move", on_move) | ||
return old_hook_init(fm) | ||
|
||
|
||
ranger.api.hook_init = hook_init |