home/config/ranger/commands.py
Damien Broqua 0d384b22bf I3 to Sway (#1)
Added some ignored folders and files

Updated waybar clock for Debian 11

Fixed bug on screen definition

Fixed Iiyama North America PL2483H 1173700204528

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Some changes for work environment

Some changes for work environment

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Added .mp3 files

Updated waybar config for laptop

Added vim-jsx

Added Teams to startup section (sad day in life!)

Updated mpd config (local source)

Added script for syncing my music

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Updated ranger config

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Replaced termite with alacritty

Replaced termite by alacritty

Updated rsync.sh results

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Updated github user

Updated irc alias

Minor changes

Added master if fail fait dev*

Added zsh prompt

Updated output definitions

Added KDEConnect at startup

Added second screen

Merge branch 'gentoo-sway' of git.darkou.fr:dbroqua/home into gentoo-sway

Updated README

Added C.A.V.A.

Fixed bug for vte

Added Tofu HHKB keyboard config

Added script to update system

Updated FuzzFm entry

Added menu entry for Carnet

Added qcad's ebuild

Updated waybar for Thinkpad

Updated temperature list for Thinkpad

Fixed bug

Updated input for thinkpad

Added script to order files for Alpine car audio system

Updated Fuzz url

Added Grammalecte plugin

Added displays for ThinkStation and ThinkPad

Merge branch 'gentoo-sway' of framagit.org:dbroqua/home into gentoo-sway

Updated waybar for laptop

Fixed bug on adjust brightness

Moved applications

Co-authored-by: dbroqua <contact@darkou.fr>
Co-authored-by: dbroqua <dbroqua@mousur.org>
Reviewed-on: #1
Co-Authored-By: Damien Broqua <dbroqua@noreply.localhost>
Co-Committed-By: Damien Broqua <dbroqua@noreply.localhost>
2021-10-21 21:40:47 +02:00

62 lines
2.7 KiB
Python

# This is a sample commands.py. You can add your own commands here.
#
# Please refer to commands_full.py for all the default commands and a complete
# documentation. Do NOT add them all here, or you may end up with defunct
# commands when upgrading ranger.
# A simple command for demonstration purposes follows.
# -----------------------------------------------------------------------------
from __future__ import (absolute_import, division, print_function)
# You can import any python module as needed.
import os
# You always need to import ranger.api.commands here to get the Command class:
from ranger.api.commands import Command
# Any class that is a subclass of "Command" will be integrated into ranger as a
# command. Try typing ":my_edit<ENTER>" in ranger!
class my_edit(Command):
# The so-called doc-string of the class will be visible in the built-in
# help that is accessible by typing "?c" inside ranger.
""":my_edit <filename>
A sample command for demonstration purposes that opens a file in an editor.
"""
# The execute method is called when you run this command in ranger.
def execute(self):
# self.arg(1) is the first (space-separated) argument to the function.
# This way you can write ":my_edit somefilename<ENTER>".
if self.arg(1):
# self.rest(1) contains self.arg(1) and everything that follows
target_filename = self.rest(1)
else:
# self.fm is a ranger.core.filemanager.FileManager object and gives
# you access to internals of ranger.
# self.fm.thisfile is a ranger.container.file.File object and is a
# reference to the currently selected file.
target_filename = self.fm.thisfile.path
# This is a generic function to print text in ranger.
self.fm.notify("Let's edit the file " + target_filename + "!")
# Using bad=True in fm.notify allows you to print error messages:
if not os.path.exists(target_filename):
self.fm.notify("The given file does not exist!", bad=True)
return
# This executes a function from ranger.core.acitons, a module with a
# variety of subroutines that can help you construct commands.
# Check out the source, or run "pydoc ranger.core.actions" for a list.
self.fm.edit_file(target_filename)
# The tab method is called when you press tab, and should return a list of
# suggestions that the user will tab through.
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
def tab(self, tabnum):
# This is a generic tab-completion function that iterates through the
# content of the current directory.
return self._tab_directory_content()