Difference between pages "Package:Apache" and "Package:Awesome (Window Manager)"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
m
 
(Updated the USE flags table. If someone could advise on the "recommended nature" of the dbus and doc flags, that would be great.)
 
Line 1: Line 1:
{{Ebuild
{{Ebuild
|Summary=The Apache Web Server
|Summary=A dynamic floating and tiling window manager.
|CatPkg=www-servers/apache
|CatPkg=x11-wm/awesome
|Maintainer=polynomial-c@gentoo.org
|Maintainer=
|Homepage=http://httpd.apache.org/
|Homepage=http://awesome.naquadah.org/
}}
}}
Apache is a powerful web server which serves html/css/cgi/pl out of the box, and can serve other languages/frameworks via extensions.


The [http://httpd.apache.org/ Apache Homepage] says this of Apache:
== About Awesome ==


<blockquote>
Awesome is a highly configurable window manager distributed under GPL-2 license. It handles both '''tiling and floating''' layouts. You can go into a '''fine-grained customization''' to suit your needs with '''Lua scripting'''. As a window manager, awesome is an ideal choice if you plan to ''get rid of your mouse''.
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.
 
</blockquote>
=== Vocabulary ===
 
;Screen: A physical monitor plugged into your computer.
;Client: A window.
;Tag: A tag is something like a workspace or a desktop that you may find in other window managers. However, it is slightly more flexible as you can attach a ''client'' to multiple tags. Moreover, each ''screen'' has its own range of tags.
;Layout: A layout is a way to arrange your ''clients'' in the current tag (eg. floating, horizontaly tiled, verticaly tiled, focused client full-screen, ...)
;Widget: A widget is a box that can contain text, images or more advanced objects. It enables you to add pieces of information in the status bar (at the top-right of each ''screen'') such as the time, the volume level or your battery load. You can also add widgets in the title bar of a ''client''.
 
== USE flags ==


== Install ==
=== USE Flags ===
{| class="wikitable" style="margin: 1em auto;" width=80%
{| class="wikitable" style="margin: 1em auto;" width=80%
! width="20%" | Use flag
! width="20%" | Use flag
Line 21: Line 26:
! width="60%" | Description
! width="60%" | Description
|-
|-
| style="text-align: center;" | debug
| style="text-align: center;" | dbus
| style="text-align: center;" | No
| style="text-align: center; background-color: red;" | No
| style="text-align: center;" | Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml.
|-
| style="text-align: center;" | doc
| style="text-align: center;" | No
| style="text-align: center;" |
| style="text-align: center;" |  Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
|-
| style="text-align: center;" | ldap
| style="text-align: center;" | No
| style="text-align: center;" |
| style="text-align: center;" | Add LDAP support (Lightweight Directory Access Protocol).
|-
| style="text-align: center;" | selinux
| style="text-align: center;" | No
| style="text-align: center; background-color: yellow" | No, unless selected by default.
| style="text-align: center;" | !!internal use only!! Security Enhanced Linux support, this must be set by the selinux profile or breakage will occur
|-
| style="text-align: center;" | ssl
| style="text-align: center;" | Yes
| style="text-align: center;" | Yes
| style="text-align: center;" |
| style="text-align: center;" |
| style="text-align: center;" | Add support for Secure Socket Layer connections.
| style="text-align: center;" | Enables awesome to receive signals from [[Dbus|dbus]] (eg. to trigger events on hotplug)
|-
|-
| style="text-align: center;" | static
| style="text-align: center;" | doc
| style="text-align: center;" | No
| style="text-align: center;" | No
| style="text-align: center;" |
| style="text-align: center;" |  
| style="text-align: center;" | !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically.
| style="text-align: center;" | Includes extra HTML documentation (using doxygen)
|-
|-
| style="text-align: center;" | threads
| style="text-align: center;" | gnome
| style="text-align: center;" | No
| style="text-align: center;" | No
| style="text-align: center;" |
| style="text-align: center; background-color: yellow;" | If you want to run Awesome in GNOME, yes. Otherwise, probably not.
| style="text-align: center;" | Add threads support for various packages. Usually pthreads.
| style="text-align: center;" | Enables you to use awesome as gnome's window manager (See. [http://awesome.naquadah.org/wiki/Quickly_Setting_up_Awesome_with_Gnome Quickly Setting up Awesome with Gnome])
|}
|}


If you want to enable any of the above use flags, create a file called <tt>/etc/portage/package.use/apache</tt> and add the options that you want to enable to it. For example:
== Installation ==
{{file|name=/etc/portage/package.use/apache|desc= |body=
 
www-servers/apache ssl threads
Just emerge it:
}}


=== Emerge ===
<console>
After you have configured the USE flags that you want to build Apache with, emerge it:
###i## emerge -a awesome
<console>###i## emerge apache</console>
</console>


== Configuration ==
Then you can add this line to your <code>~/.xinitrc</code>:
=== System ===
Many packages have apache2 use flags. These use flags are often required for an application to be supported by Apache. Setting a system wide apache2 use flag is a good idea.


{{file|name=/etc/portage/make.conf|desc=set system wide apache2 useflag|body=
{{file|name=~/.xinitrc|body=
USE="...,apache2,..."
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session awesome
}}
}}


=== Package ===
And run <code>xinit</code> to launch awesome. You can also configure a display manager instead, but this is not covered in this document.
Apache's configuration files are broken up and located in several spots.
 
*<code>/etc/conf.d/apache2</code>
== Getting Started ==
*<code>/etc/apache2/httpd.conf</code>
*<code>/etc/apache2/modules.d/*</code>
*<code>/etc/apache2/vhosts.d/*</code>


<code>conf.d</code> controls the init script, adding things to it such as -D SECURITY & -D PHP5 will enable web application fire-walling & the php scripting language.
So, you should see a nice awesome background and a top bar which includes your tags on the left (from 1 to 9), the status bar (containing a clock widget) on the right and, on the very left, an icon representing the current layout.


<code>httpd.conf</code> controls how the server behaves, at the bottom of the file it has directives to include configuration files ending in .conf in <code>/etc/apache2/modules.d</code> and <code>/etc/apache2/vhosts.d</code>
You can switch against tags by typing <code>Mod4 + [1..9]</code> or <code>Mod4 + Left/Right</code>. Where Mod4 is the "Super" key and [1..9] any digit from 1 to 9. Mod4 is the default modifier for awesome key bindings, yet you can configure another one (See [[#Configuration]]).


== Service ==
To run a program, hit <code>Mod4 + r</code>. You will be prompted for a command to run (on the top left corner, next to the tags list). Open some clients (3 or 4) and hit <code>Mod4 + Space</code>. This will switch to the next layout. Go ahead and try available layouts (notice the layout icon on the top right corner). You can also switch to the previous layout by hitting <code>Mod4 + Shift + Space</code>. To understand how each layout is arranged, you might want to add some more clients to the current tag. You can also toggle full screen for the current focused client with <code>Mod4 + f</code>.


To start apache immediately:
Here is some other interesting key bindings:
<console>
###i## rc-service apache2 start
</console>


To start apache upon boot:
* <code>Mod4 + h/l</code>: Resize clients (this will not work on some layouts)
<console>
* <code>Mod4 + Ctrl + r</code>: Restart awesome (useful when you want to test the configuration file you just edited)
###i## rc-update add apache2
* <code>Mod4 + Shift + q</code>: Quit awesome (note that this will not exit your display manager if ever you have one)
</console>


== mod_rewrite ==
There's plenty of other key bindings. We will see them, how to change them and how to create your own in the next section.
=== What is <code>mod_rewrite</code>? ===
The [http://httpd.apache.org/docs/current/mod/mod_rewrite.html Apache documentation] describes <code>mod_rewrite</code> as:


<blockquote>
== Configuration ==
The mod_rewrite module uses a rule-based rewriting engine, based on a PCRE regular-expression parser, to rewrite requested URLs on the fly. By default, mod_rewrite maps a URL to a filesystem path. However, it can also be used to redirect one URL to another URL, or to invoke an internal proxy fetch.
</blockquote>


=== Setting it up ===
Awesome user configuration files are located in <code>~/.config/awesome/</code>. For now, a single file called <code>rc.lua</code> should lie in this directory. It contains the default configuration (including widgets, tags, key bindings, ...). Note that if you don't know Lua, you can still proceed some customization. As far as I'm concerned, I only had to learn Lua basics when I started to create my own widgets.
mod_rewrite has a reputation of being difficult to set up. mod_rewrite requires following symlinks & Order allow,deny (apache 2.2) or Require all granted (apache 2.4) is set. To test functionality of mod_rewrite we will need to make a few files.  


{{fancynote|If you want to test this for web applications such as mediawiki adjust the path to <code>/var/www/localhost/htdocs/mediawiki/.htaccess</code>}}
{{fancynote|The system-wide configuration files are located in <code>/etc/xdg/awesome/</code>.}}


{{file|name=/var/www/localhost/htdocs/.htaccess|desc=enable the rewrite engine|body=
So, the first thing you might want to do is editing the default terminal (run when you hit <code>Mod4 + Return</code>). You can also change the fallback editor, but awesome uses <code>$EDITOR</code> to find your favorite one. This can be done on these lines:
RewriteEngine on
{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
RewriteRule ^test.html$ rewrite.html
terminal = "xterm"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor
}}
}}


{{file|name=/var/www/localhost/htdocs/test.html|desc=set system wide apache2 useflag|body=
For strings, <code>..</code> is the concatenation operator in Lua.
rewrite is not working
 
I think the modkey setting is well-documented enough, so next will be the layouts setting:
 
{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
local layouts =
{
    awful.layouts.suit.floating,
    awful.layouts.suit.tile,
    awful.layouts.suit.tile.left,
    awful.layouts.suit.tile.bottom,
    awful.layouts.suit.tile.top,
    awful.layouts.suit.fair,
    awful.layouts.suit.fair.horizontal,
    awful.layouts.suit.spiral,
    awful.layouts.suit.spiral.dwindle,
    awful.layouts.suit.max,
    awful.layouts.suit.max.fullscreen,
    awful.layouts.suit.magnifier
}
}}
}}


{{file|name=/var/www/localhost/htdocs/rewrite.html|desc=set system wide apache2 useflag|body=
These are the default layouts, but you can download some others and create your own. You probably won't do it now, however you might want to change the order. Personally, I don't like to have the floating layout as the default one.
rewrite is working
 
I won't go further about this file, so I would suggest you to go on browsing this file to fetch interesting settings to change. I think one of the most important section you want to check out is "Key bindings". You will see all existing mappings and what they do. As an example, find the following lines at the beginning of the "{{{ Key bindings" section:
 
{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
    awful.key({modkey,          },  "j",
        function()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({modkey,          },  "k",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
}}
}}


Then point your browser to http://127.0.0.1/test.html. You should see that the text from rewrite.html has been loaded.
This enables you to move the focus across the clients in this tag. You may be used to <code>Alt + Tab</code> and <code>Alt + Shift + Tab</code> for that. So why wouldn't you change it to suit what you are used to ?
 
{{file|name=~/.config/awesome/rc.lua|lang=lua|body=
    awful.key({"Mod1", "Shift"  },  "Tab", -- Notice the "Mod1" for Alt key instead of modkey (="Mod4")
        function()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({"Mod1", "Shift"  },  "Tab",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),
}}


{{EbuildFooter}}
{{EbuildFooter}}

Revision as of 02:16, September 16, 2014

Awesome (Window Manager)

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


About Awesome

Awesome is a highly configurable window manager distributed under GPL-2 license. It handles both tiling and floating layouts. You can go into a fine-grained customization to suit your needs with Lua scripting. As a window manager, awesome is an ideal choice if you plan to get rid of your mouse.

Vocabulary

Screen
A physical monitor plugged into your computer.
Client
A window.
Tag
A tag is something like a workspace or a desktop that you may find in other window managers. However, it is slightly more flexible as you can attach a client to multiple tags. Moreover, each screen has its own range of tags.
Layout
A layout is a way to arrange your clients in the current tag (eg. floating, horizontaly tiled, verticaly tiled, focused client full-screen, ...)
Widget
A widget is a box that can contain text, images or more advanced objects. It enables you to add pieces of information in the status bar (at the top-right of each screen) such as the time, the volume level or your battery load. You can also add widgets in the title bar of a client.

USE flags

Use flag Default Recommended Description
dbus Yes Enables awesome to receive signals from dbus (eg. to trigger events on hotplug)
doc No Includes extra HTML documentation (using doxygen)
gnome No If you want to run Awesome in GNOME, yes. Otherwise, probably not. Enables you to use awesome as gnome's window manager (See. Quickly Setting up Awesome with Gnome)

Installation

Just emerge it:

root # emerge -a awesome

Then you can add this line to your ~/.xinitrc:

   ~/.xinitrc
exec ck-launch-session dbus-launch --sh-syntax --exit-with-session awesome

And run xinit to launch awesome. You can also configure a display manager instead, but this is not covered in this document.

Getting Started

So, you should see a nice awesome background and a top bar which includes your tags on the left (from 1 to 9), the status bar (containing a clock widget) on the right and, on the very left, an icon representing the current layout.

You can switch against tags by typing Mod4 + [1..9] or Mod4 + Left/Right. Where Mod4 is the "Super" key and [1..9] any digit from 1 to 9. Mod4 is the default modifier for awesome key bindings, yet you can configure another one (See #Configuration).

To run a program, hit Mod4 + r. You will be prompted for a command to run (on the top left corner, next to the tags list). Open some clients (3 or 4) and hit Mod4 + Space. This will switch to the next layout. Go ahead and try available layouts (notice the layout icon on the top right corner). You can also switch to the previous layout by hitting Mod4 + Shift + Space. To understand how each layout is arranged, you might want to add some more clients to the current tag. You can also toggle full screen for the current focused client with Mod4 + f.

Here is some other interesting key bindings:

  • Mod4 + h/l: Resize clients (this will not work on some layouts)
  • Mod4 + Ctrl + r: Restart awesome (useful when you want to test the configuration file you just edited)
  • Mod4 + Shift + q: Quit awesome (note that this will not exit your display manager if ever you have one)

There's plenty of other key bindings. We will see them, how to change them and how to create your own in the next section.

Configuration

Awesome user configuration files are located in ~/.config/awesome/. For now, a single file called rc.lua should lie in this directory. It contains the default configuration (including widgets, tags, key bindings, ...). Note that if you don't know Lua, you can still proceed some customization. As far as I'm concerned, I only had to learn Lua basics when I started to create my own widgets.

   Note

The system-wide configuration files are located in /etc/xdg/awesome/.

So, the first thing you might want to do is editing the default terminal (run when you hit Mod4 + Return). You can also change the fallback editor, but awesome uses $EDITOR to find your favorite one. This can be done on these lines:

   ~/.config/awesome/rc.lua (lua source code)
terminal = "xterm"
editor = os.getenv("EDITOR") or "nano"
editor_cmd = terminal .. " -e " .. editor

For strings, .. is the concatenation operator in Lua.

I think the modkey setting is well-documented enough, so next will be the layouts setting:

   ~/.config/awesome/rc.lua (lua source code)
local layouts =
{
    awful.layouts.suit.floating,
    awful.layouts.suit.tile,
    awful.layouts.suit.tile.left,
    awful.layouts.suit.tile.bottom,
    awful.layouts.suit.tile.top,
    awful.layouts.suit.fair,
    awful.layouts.suit.fair.horizontal,
    awful.layouts.suit.spiral,
    awful.layouts.suit.spiral.dwindle,
    awful.layouts.suit.max,
    awful.layouts.suit.max.fullscreen,
    awful.layouts.suit.magnifier
}

These are the default layouts, but you can download some others and create your own. You probably won't do it now, however you might want to change the order. Personally, I don't like to have the floating layout as the default one.

I won't go further about this file, so I would suggest you to go on browsing this file to fetch interesting settings to change. I think one of the most important section you want to check out is "Key bindings". You will see all existing mappings and what they do. As an example, find the following lines at the beginning of the "{{{ Key bindings" section:

   ~/.config/awesome/rc.lua (lua source code)
awful.key({modkey,           },  "j",
        function()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({modkey,           },  "k",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),

This enables you to move the focus across the clients in this tag. You may be used to Alt + Tab and Alt + Shift + Tab for that. So why wouldn't you change it to suit what you are used to ?

   ~/.config/awesome/rc.lua (lua source code)
awful.key({"Mod1", "Shift"   },  "Tab", -- Notice the "Mod1" for Alt key instead of modkey (="Mod4")
        function()
            awful.client.focus.byidx( 1)
            if client.focus then client.focus:raise() end
        end),
    awful.key({"Mod1", "Shift"   },  "Tab",
        function()
            awful.client.focus.byidx(-1)
            if client.focus then client.focus:raise() end
        end),