Sinisterly
Xmonad configuration - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Computers (https://sinister.ly/Forum-Computers)
+--- Forum: Operating Systems (https://sinister.ly/Forum-Operating-Systems)
+--- Thread: Xmonad configuration (/Thread-Xmonad-configuration)

Pages: 1 2 3 4


Xmonad configuration - noize - 06-22-2013

(06-22-2013, 07:08 PM)Deque Wrote: I totally agree with you. It is crap. Nevertheless I will play around with it for a while just to know what there is to know, to see security flaws and possible problems. There are plenty people using it, also in my family, and they often need help to fix stuff. You probably know these situations. I can help them better if I know how it works.

But other than that, It is so aweful to use, the ways for the mouse are so awefully long, the whole user interface is so unintuitive and inconsistent I could just [Image: puke.gif]

(06-22-2013, 05:06 PM)noize Wrote: How did you get to make your Xmonad... like that? :headbash:

I just installed it, took my old config file from my arch system and changed it a bit (i.e. removed everything that is for xmobarr)

This is my current ~/.xmonad/xmonad.hs

Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
        [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
        , manageDocks
        ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 1

    -- Default proportion of screen occupied by master pane
    ratio   = 3/4

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

main = do
        xmonad $ gnomeConfig
                { manageHook = myManageHook <+> manageHook gnomeConfig
                , layoutHook = avoidStruts myLayout
                , workspaces = ["web", "irc", "mail", "coding"] ++ map show [5..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]

Crash! I don't know Haskell. :crying:

However, the UI is the worst ever. Many keyboard shortcuts have been removed, why on Earth? I usually find myself much more comfortable abusing my keyboard instead of my mouse (which I don't really have). When I got hands on an old XP machine, I didn't have anything like a mouse and still managed to boot, open applications, browse files in explorer, browse with IE (to go downloading Chrome), browse with Chrome and shut down. Windows 8 is designed for the average user, it's not anymore like when people using computers had at least a basical computer knowledge (though many had more), the most didn't know how to use a computer in the 80s, so computer producers began pointing at the other part, by making things simpler, easier and nicer. That's also better for everyone else, now, to have a nice GUI, sometimes, but you can't sacrifice everything else. Now, take all of this, and Windows 8's GUI is aweful, a piece of crap I wouldn't poop.

Why would I use Windows 8?

-thread splitted by deque-


RE: Xmonad for Linux is AWESOME! - Deque - 06-23-2013

(06-22-2013, 10:54 PM)noize Wrote:
(06-22-2013, 07:08 PM)Deque Wrote: I totally agree with you. It is crap. Nevertheless I will play around with it for a while just to know what there is to know, to see security flaws and possible problems. There are plenty people using it, also in my family, and they often need help to fix stuff. You probably know these situations. I can help them better if I know how it works.

But other than that, It is so aweful to use, the ways for the mouse are so awefully long, the whole user interface is so unintuitive and inconsistent I could just [Image: puke.gif]

(06-22-2013, 05:06 PM)noize Wrote: How did you get to make your Xmonad... like that? :headbash:

I just installed it, took my old config file from my arch system and changed it a bit (i.e. removed everything that is for xmobarr)

This is my current ~/.xmonad/xmonad.hs

Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
        [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
        , manageDocks
        ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 1

    -- Default proportion of screen occupied by master pane
    ratio   = 3/4

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

main = do
        xmonad $ gnomeConfig
                { manageHook = myManageHook <+> manageHook gnomeConfig
                , layoutHook = avoidStruts myLayout
                , workspaces = ["web", "irc", "mail", "coding"] ++ map show [5..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]

Crash! I don't know Haskell. :crying:

I am sorry, I forgot to mention that I installed a few other things too besides xmonad.
That was:
libghc-xmonad-contrib-dev
gnome-panel
indicator-applet-complete
indicator-multiload
dmenu

It's probably the Gnome.Config that crashed.

You should test the xmonad.hs if it compiles with: ghc --make xmonad.hs
You can avoid crashes this way and you get an error message.

I hope it works for you now.


RE: Xmonad for Linux is AWESOME! - noize - 06-23-2013

(06-23-2013, 03:01 AM)Deque Wrote:
(06-22-2013, 10:54 PM)noize Wrote:
(06-22-2013, 07:08 PM)Deque Wrote: I totally agree with you. It is crap. Nevertheless I will play around with it for a while just to know what there is to know, to see security flaws and possible problems. There are plenty people using it, also in my family, and they often need help to fix stuff. You probably know these situations. I can help them better if I know how it works.

But other than that, It is so aweful to use, the ways for the mouse are so awefully long, the whole user interface is so unintuitive and inconsistent I could just [Image: puke.gif]

(06-22-2013, 05:06 PM)noize Wrote: How did you get to make your Xmonad... like that? :headbash:

I just installed it, took my old config file from my arch system and changed it a bit (i.e. removed everything that is for xmobarr)

This is my current ~/.xmonad/xmonad.hs

Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
        [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
        , manageDocks
        ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 1

    -- Default proportion of screen occupied by master pane
    ratio   = 3/4

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

main = do
        xmonad $ gnomeConfig
                { manageHook = myManageHook <+> manageHook gnomeConfig
                , layoutHook = avoidStruts myLayout
                , workspaces = ["web", "irc", "mail", "coding"] ++ map show [5..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]

Crash! I don't know Haskell. :crying:

I am sorry, I forgot to mention that I installed a few other things too besides xmonad.
That was:
libghc-xmonad-contrib-dev
gnome-panel
indicator-applet-complete
indicator-multiload
dmenu

It's probably the Gnome.Config that crashed.

You should test the xmonad.hs if it compiles with: ghc --make xmonad.hs
You can avoid crashes this way and you get an error message.

I hope it works for you now.

lol, thanks but I didn't test it yet, "crash" just expressed my disappointment in not knowing Haskell. Biggrin

I'm trying it right away and will let you know, though, what did you mean with:

Quote:You can avoid crashes this and you get an error message.

? Maybe I'll avoid crashes when else I'd get an error message?


RE: Xmonad for Linux is AWESOME! - Deque - 06-23-2013

(06-23-2013, 08:50 AM)noize Wrote: I'm trying it right away and will let you know, though, what did you mean with:

Quote:You can avoid crashes this and you get an error message.

? Maybe I'll avoid crashes when else I'd get an error message?

I am just saying that you should compile the script by hand before trying to log out and in again to see what happens. If the config doesn't compile, you will have problems then.

I thought your xmonad crashed.

Edit: If Haskell is the problem, you might as well try another tiling window manager, i.e. wmii or awesome


RE: Xmonad for Linux is AWESOME! - noize - 06-23-2013

(06-23-2013, 09:27 AM)Deque Wrote:
(06-23-2013, 08:50 AM)noize Wrote: I'm trying it right away and will let you know, though, what did you mean with:

Quote:You can avoid crashes this and you get an error message.

? Maybe I'll avoid crashes when else I'd get an error message?

I am just saying that you should compile the script by hand before trying to log out and in again to see what happens. If the config doesn't compile, you will have problems then.

I thought your xmonad crashed.

Edit: If Haskell is the problem, you might as well try another tiling window manager, i.e. wmii or awesome

Cool, I tested it and it actually crashed this time. :lol:

Well, at first it refused to give the Terminal prompt with ALT+SHIFT+ENTER, I tried tons of other keycombos but nothing. Then a blink cursor appeared, followed by errors about failed POWER_DATA sending, or something like that.

I already had:
- libghc-xmonad-contrib-dev
- indicator-applet-complete

I installed:
- gnome-panel
- indicator-multiload
- dmenu

Then I ran:

Code:
ghc --make /home/noize/.xmonad/xmonad.hs

After that I did:

Code:
pkill -u noize

I got to the logon screen and entered the password.

For what's with awesome, I have installed it too, but prefer Xmonad.

I heard about wmii but I never tried it so far. I'll give it a shot, maybe. Though, taking a readymade configuration file like yours and editing it to my preferences shouldn't be any hard even if not knowing Haskell.

Edit: probably I'll stick with some static WM instead, but I'll surely use Xmonad too as it's a nice dynamic WM, I just need to set it up.


RE: Xmonad for Linux is AWESOME! - Deque - 06-23-2013

(06-23-2013, 11:51 AM)noize Wrote: Cool, I tested it and it actually crashed this time. :lol:

Well, at first it refused to give the Terminal prompt with ALT+SHIFT+ENTER, I tried tons of other keycombos but nothing. Then a blink cursor appeared, followed by errors about failed POWER_DATA sending, or something like that.

I already had:
- libghc-xmonad-contrib-dev
- indicator-applet-complete

I installed:
- gnome-panel
- indicator-multiload
- dmenu

Then I ran:

Code:
ghc --make /home/noize/.xmonad/xmonad.hs

After that I did:

Code:
pkill -u noize

I got to the logon screen and entered the password.

For what's with awesome, I have installed it too, but prefer Xmonad.

I heard about wmii but I never tried it so far. I'll give it a shot, maybe. Though, taking a readymade configuration file like yours and editing it to my preferences shouldn't be any hard even if not knowing Haskell.

Edit: probably I'll stick with some static WM instead, but I'll surely use Xmonad too as it's a nice dynamic WM, I just need to set it up.

If you used my config file: My xmonad.hs changes the mod key from ALT to the windows key. Maybe it was that.

If you want a basic xmonad.hs without any changes that works with Gnome just do:

Code:
import XMonad
import XMonad.Config.Gnome

main = do
    xmonad $ gnomeConfig

That doesn't have any of my modifications.


RE: Xmonad for Linux is AWESOME! - noize - 06-23-2013

(06-23-2013, 04:17 PM)Deque Wrote: If you used my config file: My xmonad.hs changes the mod key from ALT to the windows key. Maybe it was that.

How could I miss trying that?

That's perfectly working, thanks, guess I'll now just start playing around with that code (a chance to get the hang of Haskell).

Just a thing, in mine I seem to not have the top and bottom bars I can see in the picture, is it maybe dmenu? I thought I had installed but maybe I misinstalled it.

Edit: ok, this is currently my xmonad.hs file:

Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Layout.PerWorkspace
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
    [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
    , manageDocks
    ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 2

    -- Default proportion of screen occupied by master pane
    ratio   = 3/5

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

myLayoutWeb = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 1
    ratio   = 3/4
    delta   = 3/100

myLayoutCoding = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 2
    ratio   = 16/25
    delta   = 3/100

main = do
        xmonad $ gnomeConfig {
                manageHook = myManageHook <+> manageHook gnomeConfig
                , layoutHook = avoidStruts myLayout ||| onWorkspace "web" myLayoutWeb ||| onWorkspace "coding" myLayoutCoding
                , workspaces = ["main","web","coding","hacking","testing","config","else"] ++ map show [5..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]

Only thing I really can't understand is about that "delta". Ratio of the screen to variate on pane resizing? I looked for it on the web but couldn't find anything more.

Edit: I tried this code to make Firefox start automatically when switching to workspace 2 ("web") but got several errors:

Code:
myManageHook = composeAll
    [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
    , manageDocks
    ]
  , [ className =? b --> viewShift "web" | b <- myClassWebShifts ]
  where
    viewShift = doF . liftM2 (.) W.greedyView W.shift
    myClassWebShifts = ["Firefox"]

Edit: I know it gives an error, but the only buggy part is the defining of the layout (where I use "onWorkspace") as I just wanted to set different layouts for different workspaces. The trouble is just in there, though.

If no one knows how to fix this, I'll see what I can do tomorrow.


RE: Xmonad for Linux is AWESOME! - Deque - 06-24-2013

For your first problem this does the trick:
Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Layout.PerWorkspace
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
    [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
    , manageDocks
    ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 2

    -- Default proportion of screen occupied by master pane
    ratio   = 3/5

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

myLayoutWeb = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 1
    ratio   = 3/4
    delta   = 3/100

myLayoutCoding = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 2
    ratio   = 16/25
    delta   = 3/100

main = do
        xmonad $ gnomeConfig {
                manageHook = myManageHook <+> manageHook gnomeConfig
                , layoutHook =  onWorkspace "web" myLayoutWeb $
                                onWorkspace "coding" myLayoutCoding $
                                avoidStruts myLayout
                , workspaces = ["main","web","coding","hacking","testing","config","else"] ++ map show [8..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]

I will look into your Firefox problem later.

Quote:Just a thing, in mine I seem to not have the top and bottom bars I can see in the picture, is it maybe dmenu?

No, that's Gnome. I use Gnome with xmonad.
You can as well just use xmonad and make your own bars with xmobar. That's what I did on my Arch distro.

Edit: I added this startup hook to your main to launch firefox in the web workspace. See if that works (I didn't try it, I only compiled it successfully). Here is the code with the modified main function:

Code:
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.FadeInactive
import XMonad.Hooks.SetWMName
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Layout.PerWorkspace
import XMonad.Actions.SpawnOn
import System.IO

myNormalBorderColor = "#cccccc"
myFocusedBorderColor = "#0000ff"

myManageHook = composeAll
    [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat
    , manageDocks
    ]

myLayout = Mirror tiled ||| tiled ||| Full
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio

    -- The default number of windows in the master pane
    nmaster = 2

    -- Default proportion of screen occupied by master pane
    ratio   = 3/5

    -- Ratio of screen to increment by when resizing panes
    delta   = 3/100

myLayoutWeb = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 1
    ratio   = 3/4
    delta   = 3/100

myLayoutCoding = Mirror tiled ||| tiled ||| Full
  where
    tiled   = Tall nmaster delta ratio
    nmaster = 2
    ratio   = 16/25
    delta   = 3/100

main = do
        xmonad $ gnomeConfig {
                manageHook = myManageHook <+> manageHook gnomeConfig
                , startupHook = do
                        spawnOn "web" "firefox"
                , layoutHook =  onWorkspace "web" myLayoutWeb $
                                onWorkspace "coding" myLayoutCoding $
                                avoidStruts myLayout
                , workspaces = ["main","web","coding","hacking","testing","config","else"] ++ map show [8..9]
                , modMask = mod4Mask
                , normalBorderColor = myNormalBorderColor
                , focusedBorderColor = myFocusedBorderColor
                }`additionalKeys`
                [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
                , ((0, xK_Print), spawn "scrot")
                ]



RE: Xmonad configuration - noize - 06-24-2013

Thanks. Well, I'll try that soon and let you know, but for "my first problem" you mean the problem about the onWorkspace thing? I think so as it's the only part you changed, but maybe I should consider instead the second code you published?

Apart from that, would you mind clearing for me what "map show" (I noticed you edited that too) and the delta variable are?


RE: Xmonad configuration - Deque - 06-24-2013

(06-24-2013, 12:55 PM)noize Wrote: Thanks. Well, I'll try that soon and let you know, but for "my first problem" you mean the problem about the onWorkspace thing? I think so as it's the only part you changed, but maybe I should consider instead the second code you published?

Apart from that, would you mind clearing for me what "map show" (I noticed you edited that too) and the delta variable are?

The first code solves your layout problem. The second code in addition starts firefox in the web workspace. So try the second and see if it works.

show is a function that turns its argument into a string.

map applies a function to every member of a list.
I.e. map show [1,2,3]
applies show to all integers 1, 2 and 3. The result will be a list of strings: ["1", "2", "3"]

[1..9] is a list comprehension, making a list with the integers 1 to 9

I edited this, because you already have 7 named workspaces and the remaining unnamed ones have as name the key you use to access them.

Actually I should have done this, because it is shorter in your case:
Code:
workspaces = ["main","web","coding","hacking","testing","config","else", "8", "9"]

My original config has four named workspaces and [5..9]. It is shorter (or at least less annoying as programmers hate repetition) there to use map show and the list concatenation operator ++

If you want to learn Haskell I suggest you read this: http://book.realworldhaskell.org/read/

Edit: I forgot the delta. The delta is xmonad specific, though. It says how much your window increases or decreases if you resize it with mod + k or mod + h.