Skip navigation.

Posts tagged with "cli"

multi-window

, , , ...

I work in multiple client frames on several virtual desktops. My main Opera instance is running in one frame, but often I do have URLs in other frames that I want to see in Opera, as for exmaple in the frame irssi is running in, or in any other terminal I might be reading some documentation in. It is tedious to switch back and forth the various virtual desktops to reach the main Opera instance and Paste and go to the new URL. I have rather Opera coming to me - but starting Opera each time I quickly just want to look at something is no fun… (Opera's startup time isn't know to be the fastest, if you have mail and feeds in your Opera as well)

So I always only deal with opera -newwindow and have that opening a new window of the currently running instance on my virtual desktop: applications that need a browser to view documentation or help get that command, irssi has an alias that allows me to open it directly from within the irssi session, bash has an appropriate alias…

My emacs keyboard bindings for Opera also have the Ctrl-x k binding to easily close the current window.

et voilà, I have an Opera window readily available wherever I am working, without having to give up my huge sessions, and without having to wait for Opera to start up.


Note: make sure not to close a window with several tabs in it if you want to have them part of your session: currently there is unfortunately no way of restoring an accidentally closed window (accidentally closed tabs are easily re-opened), but, pssst, this is fixed in Kestrel.

Yet another note: Emacs will have multi-tty support in the next-but-one version (23). The multi-tty branch has just been merged to the Savannah CVS repository.

unleash the powers

, , ,

Elsewhere I already have declared my love for the CLI - as I said back then, interaction via the command line is all about dialog. When interacting through a keyboard, your two choices are either to remember the exact binding for a specific action, or to start a dialog, telling your application the actions in plain English. Well, almost… :smile:

I have never really understood why CLI and GUI should be antonyms, why you should either enjoy graphics and be forced to point-click-drag-and-drop interaction, or dwell in the terminal, uttering your commands in lonely dialogs with the machine. It's really not that I don't like terminals - but for a few tasks graphical approaches are simply better. And browsing is one such task.

There is no reason not to have the power a command line offers, available also in GUIs. I am not currently aware of any major GUI application that spouses the two interfaces - the closest you get are some TUIs, Emacs or (I am told - no gamer myself) some games, such as Quake. Well - until a few days ago Rune came to my office…



tab 0 > go http://opera.com/
Loading http://opera.com/
tab 0 > newtab
Created tab number 1
tab 0 > showtab 1
Switched to tab number 1

Imagine your focus moving only between the document and one mini-buffer to issue commands with, or to get some feedback from the active page:
tab 1 > go javascript:alert('hi');
Window got an alert:
"hi"
tab 1 > answer ok
Dismissed alert
tab 1 >


I could go on forever telling you how much more sense it makes to have the login dynamics of a terminal in the case of HTTP authentication, to be able to query document information from a prompt and not to have either move my focus to a panel or to get intrusive dialogs, etc… This approach is just the most fabulous interaction - made possible by… our WebUI. Yessir, a UI for Opera, created using only standard Web technologies, such as HTML, CSS, JavaScript and DOM. Let me note one thing: the console UI is not the default WebUI the SDK is shipped with - it is just another possible UI, one of infinite possibilities open there to Web developers: unleash the powers, be creative!

tab 0 > version
Web UI console rev. 2080


(And a very personal thank you to Rune for dreaming up this UI)

N.B. The WebUI is a feature of the opera 9 SDK for devices.
P.S. The screenshot shows one of the possible console UIs, à la Quake - there is a binding to toggle the mini-buffer overlay on or off.

jhead

, ,

…is a small, simple but powerfull command line application, primarily thought as a tool for viewing, extracting, handling or modifying EXIF data in images - and extremely useful for preparing your picture collections.

After downloading the pics from my camera, I first lowercase all files (never really got why digital cameras all save in uppercase) and then run

jhead -autorot *.jpg
to autorotate all images according to their EXIF tag. After this, the orientation tag is set to "1" (which is normal orientation), in order to avoid rotating it once more in case you'd run the command again.

Jpeg images contain, among their EXIF data, also thumbnails, used by digital cameras to preview the image on their LCD display. It is trivial to extract them:

jhead -st "thumbnails/&i" *.jpg
where thumbnails/ is a directory previously created, to contain the thumbnails; and the variable &i tells jhead to use the image's name for the thumbnail.

Et voilà…

jhead has a plethora of options for more advanced usage, and your needs might be different than mine - so I'll leave them to you to discover…

Incidentally, the author of jhead is the very same guy who built his own home pipe organ. :smile:

emacs & unicode

, ,

I run most applications in terminal, and Emacs is not an exception. But I had been struggling with Emacs 21.4.1 and had some trouble with some Unicode input - I'd have no trouble in X, but there are several reasons why I'd still prefer running it in terminal.

I just upgraded to the CVS version 22.0.50.1, and have solved all my troubles.

:sherlock:

--remote

, , , ...

More than once I have heard people asking for an easy way to pass interesting links from one Opera instance to another: ways to forward that one URL you found at work to yourself at home. A simple solution is to collect all those URLs in a mail and send that to yourself. Some more sofisticated users send a private message to their IRC-self at home, with the URL.

Since I do use a console IRC client, irssi, running in screen on my home machine and I load that session via ssh from anywhere I am, I devised a more efficient way to solve this task.

Since the ssh session is not used to forward X, I export the local DISPLAY at home in screen - and use the --remote command line option to foward the URL to Opera directly, skipping the one additional step of forwarding it to myself on IRC or via mail.

$ export DISPLAY=:0

once and forever in the screen session, then

$ opera --remote "openURL(http://example.com/,new-page)"

in a screen - and when I come home I'll have all those URLs waiting for me, each in its own tab.

#!/bin/bash

,

…cheat-sheet - I keep forgetting one or the other of the useful expansions and substitutions bash has to offer…
# expansions
!$                 # expands to the end of the last command
!*                 # expands to all arguments of last command
!!                 # expands to last command
!number            # expands to command number in `history`
!-number           # expands to command number commands ago
!abc               # expands to the last command starting with abc

# modifiers :p # only prints output :h # only head, removing trailing component(s) :t # only tail, removing leading component(s) :r # removes trailing suffix of the form .xxx :e # removes all but trailing suffix :number # number of arguments of last command - therefore !:number* # is from number to end of arguments of last command… and !* # is a shortcut for !:1*

# substitutions :s/wrong/right/ # substitution of wrong with right in the command :g # global (as a modifier to :s) - as in :gs/wrong/right/ & # repeats previous substitution ( :s/one/&.more/ ) ^wrong^right # replaces wrong with right in the previous command, and runs it

Additional note

^R incrementally searches your command history backwards - hit it again to get to the next occurrence. I badly miss the ability to search your buffer in xterm - rxvt-unicode offers this neat feature.

sine qua non

, ,

  • bash
  • screen
  • irssi
  • ssh
  • emacs
  • gcc

and the one GUI application I use, opera.

the lost dialog

, ,

Interaction with the computer has mainly evolved around the WIMP approach, requiring a low learning curve and little effort from the user - with the basic misunderstanding that userfriendly does not necessarily mean only easy to use, but might also require some learning process. However, in our modern society nobody is willing to commit oneself to the learning process any more, people want their food pre-chewed and pre-digested; they have lost the capability and the will to engage in a dialog, to listen, to think, to react - that is all too much effort. Our society looks for the brain-dead entertainment that requires no interaction and the least intellectual effort.

I have the suspicion that there is a link between this and the decline of the CLI - interaction via the command line is all about dialog, commands are given, questions are asked, and responses are read: all based on the simple and familiar syntax <doSomething> <toThis>.

I do not want to say that the command line is the best, nor the only solution. But for several tasks it might well be a better UI than the graphical one, and in many ways a more efficient one - but we too easily discard this option a priori due to the fact that it is so far away from the well-known WIMP environment - that it requires you to sit up, read your screen, parse the string, and finally activate your brain and decide how to react - it is asking you for a dialog.

I like the command line.

January 2010
S M T W T F S
December 2009February 2010
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30