BunsenLabs / bunsen-utilities

https://pkg.bunsenlabs.org/debian/pool/main/b/bunsen-utilities/
GNU General Public License v3.0
31 stars 21 forks source link

bl-kb --gui outputs unnecessary text #42

Closed johnraff closed 8 years ago

johnraff commented 8 years ago

bl-kb when called with the --gui option, apart from writing to kbinds.txt for reading by yad, also outputs the same content to stdout. This is not needed when using yad, and if the command is issued without a terminal (eg from the openbox menu) then the result just goes into ~/.xsession-errors.

It can be avoided by editing line 101 to have print(line) executed only when `--gui`` has not been used, ie by adding another indent. That section would thus look like:

def output_keybinds(arrShortcut,gui):
    """loop through array, and format output then write to file"""
    for i in range(0,len(arrShortcut)):
        exe=str(arrShortcut[i][0])
        keybinding=str(arrShortcut[i][1])
        execute=str(arrShortcut[i][2])
        if gui:     #format output for text window
            if len(execute)>80 :
                execute=execute[:75]+"....."
            line = "{:2}".format(i) + "\t" + "{:<16}".format(keybinding)\
            + "\t" + execute
        else:   #format text for pipemenu
            line = exe + "{:<16}".format(keybinding) + "\t" + execute
            print(line)
        write_file(line)

If this were done, the error message on line 48 should be changed to:

            msg = "\n\n\tUSAGE: to display keybinds in a text window use 'bl-kb --gui'\n\n"

ie redirection to /dev/null would not be needed.

https://github.com/BunsenLabs/bunsen-pipemenus/issues/46

johnraff commented 8 years ago

Fixed in the deuterium branch.