Logo54.156.78.4 
  Home  News  Recent  Forums  Search  Contact
  Menu
 Username

 Password


   Register here

 Main menu
   View images
   BBCode test
 
 Content
   Statement of intent
   Terms Of Service
   IRC Channel
   List Content

 In cooperation with
  OS4Depot.net
  OpenAmiga.org
  OS4Welt

 Links
  AmigaOS4
  IntuitionBase
  UtilityBase
  Amiga Flame
  Amiga Spirit
  AmiKit
  Aminet
  AmiBay
  AmigaBounty
  AmigaWorld
  Exec
  Amiga.cz
  View comments
Title  
  Forums
    Software
      AmigaOS 4  
ChrisHshow current directory in Shell title bar?20110117 20:31
I've been growing increasingly convinced that showing the current directory in the Shell prompt is TOTALLY the wrong way to do it. I just end-up wasting half the Shell's width (or worse) when in a deep directory.

It would make SO much more sense to show the current directory in the Shell window's title bar. So is this possible to do?

If not, then I hope the OS4 devs will consider it for the up-coming CON replacement.
Navigate: 1-20 21-22 
tonywRe: show current directory in Shell title bar?20110117 22:52  #1082
@ChrisH

Easy. Just include the formatting characters "%S" within the title string, like this:

CON:680//600/690/Current Dir: %S/Close
slayerRe: show current directory in Shell title bar?20110117 23:37  #1084
@tonyw

hmmm, I could be wrong since I can't test if from this hopeless work laptop LOL

but wouldn't wnat you suggest only work on the initial execution of the new shell window?

I mean cd / for example wouldn't update the current shown directory in the title bar like the shell prompt does? unless %S is some special realtime updating embedded Amiga routine? ;)
TSKRe: show current directory in Shell title bar?20110118 00:22  #1085
@slayer

Just tested. Contents of the titlebar is updated in realtime. Also if you add %N it will show the Shell process number. (KingCON does that all automaticly or are there some settings I've forgotten.)

@ChrisH
You can add linefeed into the prompt to make the prompt two lines long. Also use escapes to change colours and so on.
markoRe: show current directory in Shell title bar?20110118 02:32  #1086
@TSK

Do you know what the escape-codes are for changing colors?
slayerRe: show current directory in Shell title bar?20110118 04:37  #1087
@TSK

Well that is pretty cool :-)

Thanks for sorting that out
tonywRe: show current directory in Shell title bar?20110118 04:42  #1088
@marko

In the "old" (current) console you can only change from one to another of the system "pens".
The sequence is:
<ESC>[3Nm
where N is a digit from 0 - 7 (pen number) that you want as the primary pen colour.

Also:
<ESC>[4Nm
sets the character background colour (again, pen 0-7).

You can set them both at once with:
<ESC>[3N;4Mm
if N or M is "9", it resets to default (pen 1 on background pen 0).

It's described in the SDK:Documentation/Autodocs/console.doc under CMD_WRITE.
amigo1Re: show current directory in Shell title bar?20110118 07:23  #1090
@tonyw

That's cute!! thx! :-)
markoRe: show current directory in Shell title bar?20110118 16:15  #1094
@tonyw

Cool, I'm gonna check the Autodocs, thanks!
TSKRe: show current directory in Shell title bar?20110118 17:40  #1095
*N is the linefeed in DOS scripts, Shell and requesters. %R displays the last return code in prompt.
ChrisHRe: show current directory in Shell title bar?20110118 19:27  #1099
@tonyw
Awsome! Many thanks :-)
nbacheRe: show current directory in Shell title bar?20110118 22:40  #1105
@ChrisH

Actually, there's lots more to play around with in the prompt.

As an example, here's the prompt I set in my Shell-Startup; hope it renders unharmed:

prompt "*E[[3m%N.%S %R %W [%E] *`C:Date` *n> *E[31m"


Well, it strangely renders almost correctly, but not completely. The first asterisk and capital E should be followed by one left square bracket and the number 33, not by two left square brackets and the number 3 (hope that is clear ;-)). Oh, and note that those are backticks around the C:Date command.


Best regards,

Niels
kas1eRe: show current directory in Shell title bar?20110118 23:02  #1106
@tonyw
I should ask that :) :


In the "old" (current) console you can only change from one to another of the system "pens".


That mean that you as beta-tester already use "new" (not current) console, and in which you can do more than with "old" one ? Can you say a bit more ?:)
TSKRe: show current directory in Shell title bar?20110118 23:46  #1108
@nbache

What are %W and %E ?
tonywRe: show current directory in Shell title bar?20110119 00:09  #1109
@TSK

From Documentation/Shell.doc, here are the formatting characters you can use in a Shell. You can use them in a prompt (using the command "prompt xxx" as Niels showed, or in the Title string (as I mentioned before). The window title string is refreshed after each command.



The substitutions available for the <prompt> string are:

%E Displays the execution time of the last program run; this
is given as the number of seconds, followed by the decimal
point, and the fraction of a second. This corresponds to
the value of the $_RunTime environment variable
%N Displays the Shell number. This is also available in the
form of the $Process environment variable.
%R Displays the return code for the last operation. This is
also available as the $RC environment variable.
%S Displays the current directory.
%W Displays the error code set by the last operation; this
is what the WHY command will print the corresponding
error message for. This is also available as the $Result2
environment variable.


@kas1e:
I can't tell you much more just yet. I'll be putting up a blog entry on the new console sometime soon.
abalabanRe: show current directory in Shell title bar?20110119 11:35  #1112
@kas1e

I think Tony is a bit more than "just" a "beta-tester" of the new console/shell ;-)
kas1eRe: show current directory in Shell title bar?20110119 14:03  #1115
@abalaban

I think it was ssolie who works on new console/shell ? (can be wrong of course)
rigoRe: show current directory in Shell title bar?20110119 21:04  #1120
@kas1e

You are :P

Simon
kas1eRe: show current directory in Shell title bar?20110119 22:51  #1123
@rigo
Blah, i remember now that i few times ask Ssolie in some threads, "when new shell will be done", "why it take so much time", and thinking why he not answer about :)

@tonyw
Pretty interesting to see new blog entry from you , hope that stuff will be avail in the next update, we already wait for it too long :)
markoRe: show current directory in Shell title bar?20110120 19:03  #1137
@tonyw

In the "old" (current) console you can only *snip*

Hmmm... are these escape-codes going change in this "new" console, will there be a way to tell which console is being used in that case?
tonywRe: show current directory in Shell title bar?20110121 12:26  #1201
@marko

The new console has a "palette" (set of eight foreground and eight background colours) that you can choose. You can have the default palette containing the system pens, one of two ANSI palettes of primary colours or your own palette containing colours you can select using the prefs editor. It's your choice as a user.
(edit)
The escape codes I listed above will select colours from the current palette, whatever that is.
(/edit)


...will there be a way to tell which console is being used?


Not quite sure what you are asking -
Are you a script that wants to know what version console is running? No, there isn't a way to respond to the script (except by using the Version command).
Are you a program that can issue a programmed request - yes, you can use GetAttrs() to interrogate the console (it would be rejected as an unknown command by the old console).
Navigate: 1-20 21-22 
Home
Snack! forum website engine, Created in 2008 by Björn Hagström