Skip to content

Commit

Permalink
return to autodetect file manager
Browse files Browse the repository at this point in the history
  • Loading branch information
DoTheEvo committed Mar 28, 2015
1 parent f02afed commit c16cb14
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions angrysearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,11 @@ def read_settings(self):
self.set['file_manager_receives_file_path'] = \
self.string_to_boolean(self.settings.value(
'file_manager_receives_file_path'))
else:
self.detect_file_manager()
else:
self.detect_file_manager()

if self.settings.value('number_of_results'):
if ((self.settings.value('number_of_results')).isdigit()):
self.set['number_of_results'] = \
Expand Down Expand Up @@ -309,6 +314,16 @@ def show_first_500(self):
self.status_bar.showMessage(str(total))
self.center.search_input.setFocus()

def detect_file_manager(self):
try:
fm = subprocess.check_output(['xdg-mime', 'query',
'default', 'inode/directory'])
self.set['file_manager'] = fm.decode('utf-8').strip()
print('autodetected file manager: ' + self.set['file_manager'])
except Exception as err:
self.set['file_manager'] = 'xdg-open'
print(err)

def single_click(self, QModelIndex):
path = QModelIndex.data()
if not os.path.exists(path):
Expand Down

0 comments on commit c16cb14

Please sign in to comment.