Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
XTerm as background for Fluxbox
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
xibalban
n00b
n00b


Joined: 27 Jan 2015
Posts: 3

PostPosted: Tue Jan 27, 2015 6:24 am    Post subject: XTerm as background for Fluxbox Reply with quote

Hi fellas,

Greetings!!

I'm a new Gentoo user and have finished installing my first build. I have been very satisfied with the end product, where I have a fluxbox up and running with some bare-bones applications for my regular use.

However, I must invoke the "startx" command from the console (tty1) after I log in to have the X server up and running. I have configured the xinitrc to load up fluxbox and one xterm window in fullscreen mode once the X server starts.

But, I've been struggling to customise the desktop to my needs, which is:

1. To start X server immediately after I log in from the console (I don't require a display manager for login): Modifying the bashrc file as suggested by some didn't help much.
2. To lock the xterm window in fullscreen mode, but letting it be the lowest in the stack of other programs. Or, to set the xterm window as background.
3. To disable Ctrl+Alt+F1 once I've started fluxbox.
4. I'd want to launch other programs from the xterm and by default set focus to this new application's window.
5. To launch applications without the title bar (or frames), as I could always use keyboard shortcuts to close, maximize, etc.

The idea is, to conceal fluxbox altogether. I wouldn't have installed it anyway, if some applications (like geany) didn't depend on it.

Thanks in advance!!
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Tue Jan 27, 2015 11:43 am    Post subject: Re: XTerm as background for Fluxbox Reply with quote

xibalban ... welcome to gentoo.

xibalban wrote:
1. To start X server immediately after I log in from the console (I don't require a display manager for login): Modifying the bashrc file as suggested by some didn't help much.

Something like the following (at the end of ~/.bashrc):

Code:
ask() {   
    echo -n "$@" '[y/n] ' ; read ans
    case "$ans" in
        y*|Y*) return 0 ;;
        *) return 1 ;;
    esac
}

if [[ $TERM == "linux" ]] ; then
    ask "startx?" && exec startx
fi

There are probably other ways of achieving the same, there is a console login manager type thing ... though I can't remember the name of it right now.

xibalban wrote:
2. To lock the xterm window in fullscreen mode, but letting it be the lowest in the stack of other programs. Or, to set the xterm window as background.

A 'background' doesn't recieve focus and so doesn't recieve input. There are terminals like x11-terms/root-tail which are designed to replace the background but they only provide output not input. For there to be input the WM needs to treat the terminal as a "window", which means that its focus changes in relation to other windows. If its "locked in fullscreen" then this is the current focus, and other windows loose that focus ... so really, I'm not sure how this can be done, other than via a tiled WM with xterm being the container and other windows floating. Note, I'm not a fluxbox user, so someone may have some suggestions on how to do this, but I imagine this may not be possible due to how fluxbox treats focus and window.

xibalban wrote:
3. To disable Ctrl+Alt+F1 once I've started fluxbox.

Create a /etc/X11/xorg.conf.d/01-serverflags.conf with the following:

Code:
Section "ServerFlags"
  Option "DontVTSwitch" "true"
EndSection

xibalban wrote:
4. I'd want to launch other programs from the xterm and by default set focus to this new application's window.

Generally a new window gains focus, you may have it set that the focus is "sloppy" or "focus follows mouse", or similar. I imagine fluxbox has some option to change how windows are focused.

xibalban wrote:
5. To launch applications without the title bar (or frames), as I could always use keyboard shortcuts to close, maximize, etc.

The title bar is provided by the WM, fluxbox should allow this to be set to false.

xibalban wrote:
The idea is, to conceal fluxbox altogether. I wouldn't have installed it anyway, if some applications (like geany) didn't depend on it.

hmmmm ... are you sure? I don't see it as a dependency.

Code:
% equery -NC depgraph -l =dev-util/geany-1.23.1
 * Searching for geany1.23.1 in dev-util ...
 * dependency graph for dev-util/geany-1.23.1
 [  0]  dev-util/geany-1.23.1  x86
 [  1]  x11-libs/gtk+-2.24.25  (>=x11-libs/gtk+-2.16) x86
 [  1]  dev-libs/glib-2.40.2  (>=dev-libs/glib-2.20) x86
 [  1]  x11-libs/vte-0.28.2-r206  (x11-libs/vte) x86
 [  1]  virtual/pkgconfig-0-r1  (virtual/pkgconfig) ~x86
 [  1]  dev-util/intltool-0.50.2-r1  (dev-util/intltool) x86
 [  1]  sys-devel/gettext-0.18.3.2  (sys-devel/gettext) x86
 [  1]  sys-apps/sed-4.2.1-r1  (>=sys-apps/sed-4) x86
[ dev-util/geany-1.23.1 stats: packages (8), max depth (1) ]

xibalban wrote:
Thanks in advance!!

You're welcome & best ... khay
Back to top
View user's profile Send private message
xibalban
n00b
n00b


Joined: 27 Jan 2015
Posts: 3

PostPosted: Thu Jan 29, 2015 6:53 am    Post subject: Re: XTerm as background for Fluxbox Reply with quote

khayyam wrote:
xibalban ... welcome to gentoo.

It's a privilege to join this wonderful community.

khayyam wrote:

Something like the following (at the end of ~/.bashrc):

Code:
ask() {   
    echo -n "$@" '[y/n] ' ; read ans
    case "$ans" in
        y*|Y*) return 0 ;;
        *) return 1 ;;
    esac
}

if [[ $TERM == "linux" ]] ; then
    ask "startx?" && exec startx
fi


I didn't want the ask() function, so I just added:
Code:

if [[ $TERM == "linux" ]] ; then
    exec startx
fi

This brought up the X window environment immediately. However, when I switched to Ctrl+Alt+F2 (for instance), another instance of startx (I think) was started as soon as I logged in. I don't want that to happen. Perhaps the script requires modification, some kind of a check to ensure that X only starts from the first terminal (tty1) and not from others.
khayyam wrote:

A 'background' doesn't recieve focus and so doesn't recieve input. There are terminals like x11-terms/root-tail which are designed to replace the background but they only provide output not input. For there to be input the WM needs to treat the terminal as a "window", which means that its focus changes in relation to other windows. If its "locked in fullscreen" then this is the current focus, and other windows loose that focus ... so really, I'm not sure how this can be done, other than via a tiled WM with xterm being the container and other windows floating. Note, I'm not a fluxbox user, so someone may have some suggestions on how to do this, but I imagine this may not be possible due to how fluxbox treats focus and window.

The root-tail application seems cool enough to replace my otherwise dull background. Thanks for the tip, I shall have a go at it.
khayyam wrote:

Create a /etc/X11/xorg.conf.d/01-serverflags.conf with the following:

Code:
Section "ServerFlags"
  Option "DontVTSwitch" "true"
EndSection

Thanks, that worked. But, I may not use it after-all since I do feel the need to jump to another console instance for maintenance, etc.
khayyam wrote:

hmmmm ... are you sure? I don't see it as a dependency.

Code:
% equery -NC depgraph -l =dev-util/geany-1.23.1
 * Searching for geany1.23.1 in dev-util ...
 * dependency graph for dev-util/geany-1.23.1
 [  0]  dev-util/geany-1.23.1  x86
 [  1]  x11-libs/gtk+-2.24.25  (>=x11-libs/gtk+-2.16) x86
 [  1]  dev-libs/glib-2.40.2  (>=dev-libs/glib-2.20) x86
 [  1]  x11-libs/vte-0.28.2-r206  (x11-libs/vte) x86
 [  1]  virtual/pkgconfig-0-r1  (virtual/pkgconfig) ~x86
 [  1]  dev-util/intltool-0.50.2-r1  (dev-util/intltool) x86
 [  1]  sys-devel/gettext-0.18.3.2  (sys-devel/gettext) x86
 [  1]  sys-apps/sed-4.2.1-r1  (>=sys-apps/sed-4) x86
[ dev-util/geany-1.23.1 stats: packages (8), max depth (1) ]


Well, you're right. Fluxbox isn't required but X is, and that's what I implied. In fact, I have disabled fluxbox from xinitrc and all applications still work great.
However, I don't seem to figure out how to switch between these applications. The applications which require me to constantly switch (like when using Alt+Tab in fluxbox) are:

1. xterm
2. geany
3. mupdf
4. links -g

I might want to fire up another xterm occasionally, and switch between the two xterm windows. Currently, once the application is launched it just sits in the foreground until you close (quit) it. Also, I noticed that I could no longer run applications in fullscreen without fluxbox.
khayyam wrote:

You're welcome & best ... khay

I cannot thank you enough, for not just have you been able to assist me with the issues in question, but with your singular response represented the whole forum and established how helpful this community really is.
Back to top
View user's profile Send private message
grot
n00b
n00b


Joined: 17 Dec 2014
Posts: 33

PostPosted: Thu Jan 29, 2015 10:21 am    Post subject: Re: XTerm as background for Fluxbox Reply with quote

xibalban wrote:

I didn't want the ask() function, so I just added:
Code:

if [[ $TERM == "linux" ]] ; then
    exec startx
fi

This brought up the X window environment immediately. However, when I switched to Ctrl+Alt+F2 (for instance), another instance of startx (I think) was started as soon as I logged in. I don't want that to happen. Perhaps the script requires modification, some kind of a check to ensure that X only starts from the first terminal (tty1) and not from others.


Try executing "tty" in your console. It should print out like "/dev/tty1" or "/dev/tty2" etc. I had to look up how to save evaluated commands in bash, but this should work:
Code:

VAR=$(tty)
if [[ $VAR == "/dev/tty1" ]] ; then
    exec startx
fi


That's actually so simple I might start using it myself.. thanks khay :D


xibalban wrote:

Thanks, that worked. But, I may not use it after-all since I do feel the need to jump to another console instance for maintenance, etc.


I would definitely think that would be the right option. If you used that option, the only way to get to the shell would be LiveCD or SSH, right? I don't like the sound of that..

xibalban wrote:


Well, you're right. Fluxbox isn't required but X is, and that's what I implied. In fact, I have disabled fluxbox from xinitrc and all applications still work great.
However, I don't seem to figure out how to switch between these applications. The applications which require me to constantly switch (like when using Alt+Tab in fluxbox) are:

1. xterm
2. geany
3. mupdf
4. links -g

I might want to fire up another xterm occasionally, and switch between the two xterm windows. Currently, once the application is launched it just sits in the foreground until you close (quit) it. Also, I noticed that I could no longer run applications in fullscreen without fluxbox.
khayyam wrote:

You're welcome & best ... khay

I cannot thank you enough, for not just have you been able to assist me with the issues in question, but with your singular response represented the whole forum and established how helpful this community really is.


The community is great. It was hard for me to pick Arch over Gentoo when I started out... but I had a friend who had used Arch in the past.. presystemd though lol, so he turned out to not be all that helpful.

So, most linux DE's have 'workspaces'. I like xfce and recently I've moved to openbox. I set a lot of hotkeys - on arch for XFCE I had to reach into the AUR to get a more recent xfce build - but this is what I do:
I set Windows/Super key + j to be 'next' workspace, and super + k to be the 'previous' workspace. Then you can fullscreen windows and easily switch between them. You can also set up a graphical switcher on a start-menu type panel so you can change workspaces with your mouse.
I also set super+shift+j to be "move active window to next workspace", etc.

xibalban wrote:

5. To launch applications without the title bar (or frames), as I could always use keyboard shortcuts to close, maximize, etc.


This is actually why i'm using openbox - I can right click a title and select "Un/decorate" and it removes the "window decorations" (my god it took me a long time to find out what the damned titlebar was called).
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Thu Jan 29, 2015 1:40 pm    Post subject: Re: XTerm as background for Fluxbox Reply with quote

xibalban wrote:
I didn't want the ask() function, so I just added:
Code:
if [[ $TERM == "linux" ]] ; then
    exec startx
fi

This brought up the X window environment immediately. However, when I switched to Ctrl+Alt+F2 (for instance), another instance of startx (I think) was started as soon as I logged in. I don't want that to happen. Perhaps the script requires modification, some kind of a check to ensure that X only starts from the first terminal (tty1) and not from others.

xibalban ... well, that's part of the reason for 'ask()', so you're prompted, but grot's suggestion of testing for tty1 is probably what you want. The benefit of using ask() and $TERM as the test condition is that you can then login on tty1 as root, and tty2 as user, and still be prompted to start the xsession. As I said there are probably other ways to achieve this ... I mentioned before a console display/session manager and have now remembered the name, its x11-misc/cdm.

xibalban wrote:
khayyam wrote:
Create a /etc/X11/xorg.conf.d/01-serverflags.conf with the following:

Code:
Section "ServerFlags"
  Option "DontVTSwitch" "true"
EndSection

Thanks, that worked. But, I may not use it after-all since I do feel the need to jump to another console instance for maintenance, etc.

It'd generally only set this on shared workstation with a display manager so that users can't switch VT's and leave the machine inaccessible to other users (or their login unattended). Oh, and BTW, the reason for the 'exec startx' is so that should you lock the display someone can't switchVT, kill the xsession, and get access to your login.

xibalban wrote:
Well, you're right. Fluxbox isn't required but X is, and that's what I implied. In fact, I have disabled fluxbox from xinitrc and all applications still work great. However, I don't seem to figure out how to switch between these applications. The applications which require me to constantly switch (like when using Alt+Tab in fluxbox) are: [...]

Well, that's the whole purpose of a WM (like fluxbox, i3, etc) ... it provides the method of window selection, basically "managing" windows. You can run X11 without a WM but then you loose this functionality.

xibalban wrote:
I might want to fire up another xterm occasionally, and switch between the two xterm windows. Currently, once the application is launched it just sits in the foreground until you close (quit) it. Also, I noticed that I could no longer run applications in fullscreen without fluxbox.

A WM isn't a huge resource burden, and as I said it provides this kind of "management".

xibalban wrote:
khayyam wrote:
You're welcome

I cannot thank you enough, for not just have you been able to assist me with the issues in question, but with your singular response represented the whole forum and established how helpful this community really is.

Your appreciation is appreciated :)

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum