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


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

(06-24-2013, 01:48 PM)Deque Wrote:
(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.

Thanks, this was a nice clarification.

Yeah, I knew the "delta" variable was XMonad specific, I didn't know about the possibility to resize panes with mod + k / h (though, it looks to me like it is k / l instead) and so I got confused.

I think that at least for now I won't learn Haskell. Would you mind remembering me what was the layout problem you're talking about :huh: ? lol, I can't remember about it.

Edit: oh, you mean the problem in laying out workspaces in different ways, yeah.

Edit: "xmonad.hi: openBinaryFile: permission denied"
I just removed xmonad.hi and xmonad.o and it worked nice.


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

Deque Wrote:The second code in addition starts firefox in the web workspace. So try the second and see if it works.

Tested. I also added a line to try and spawn Terminal on the main workspace, but it does not work. Firefox opens up in "main" instead (it did also before adding the line about Terminal). If I instead use MOD + Q to apply the new config file while I am in another workspace, Firefox opens up there, so I can tell it opens up in the current workspace, not in a fixed one.

My current 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 XMonad.Layout.PerWorkspace import XMonad.Actions.SpawnOn import System.IO myNormalBorderColor = "#cccccc" myFocusedBorderColor = "#0000ff" myManageHook = composeAll [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat , manageDocks ] myLayout = tiled ||| Mirror 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 = 1/100 myLayoutWeb = Mirror tiled ||| tiled ||| Full where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 3/4 delta = 1/100 myLayoutCoding = tiled ||| Mirror tiled ||| Full where tiled = Tall nmaster delta ratio nmaster = 2 ratio = 7/12 delta = 1/100 main = do xmonad $ gnomeConfig { manageHook = myManageHook <+> manageHook gnomeConfig , startupHook = do spawnOn "main" "bash" spawnOn "web" "firefox" , layoutHook = onWorkspace "web" myLayoutWeb $ onWorkspace "coding" myLayoutCoding $ avoidStruts myLayout , workspaces = ["main","web","coding","hacking","testing","6","7","8","9"] , modMask = mod4Mask , normalBorderColor = myNormalBorderColor , focusedBorderColor = myFocusedBorderColor }`additionalKeys` [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s") , ((0, xK_Print), spawn "scrot") ]

Also, I just logged in and new panes opened up fine, but after typing this, I tried opening up Terminal in another workspace and (also any other program does the same) it overlaps the top and bottom Gnome bars completely.


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

(06-24-2013, 07:37 PM)noize Wrote: Tested. I also added a line to try and spawn Terminal on the main workspace, but it does not work. Firefox opens up in "main" instead (it did also before adding the line about Terminal). If I instead use MOD + Q to apply the new config file while I am in another workspace, Firefox opens up there, so I can tell it opens up in the current workspace, not in a fixed one.

After a lot of trying and research I found the reason: http://www.haskell.org/haskellwiki/Xmonad/General_xmonad.hs_config_tips

Quote:gnome-terminal by default starts a single back-end "factory" and spawns terminal windows from it; all of these windows will share the same resource name and class. Use the --disable-factory option with --name= or --class= to ensure that the created window is not shared with unrelated terminals.

Other terminal emulators for Gnome and KDE are likely to behave similarly. (Konsole does not, at least as of this writing; but it does send itself to the background, which will break XMonad.Actions.SpawnOn unless you use the --nofork option.) Look for options to disable shared sessions or factories.

(06-24-2013, 07:37 PM)noize Wrote: Also, I just logged in and new panes opened up fine, but after typing this, I tried opening up Terminal in another workspace and (also any other program does the same) it overlaps the top and bottom Gnome bars completely.

Use avoidStruts:

Code:
layoutHook = onWorkspace "web" (avoidStruts myLayoutWeb) $ onWorkspace "coding" (avoidStruts myLayoutCoding) $ avoidStruts myLayout



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

(06-25-2013, 12:41 PM)Deque Wrote:
(06-24-2013, 07:37 PM)noize Wrote: Tested. I also added a line to try and spawn Terminal on the main workspace, but it does not work. Firefox opens up in "main" instead (it did also before adding the line about Terminal). If I instead use MOD + Q to apply the new config file while I am in another workspace, Firefox opens up there, so I can tell it opens up in the current workspace, not in a fixed one.

After a lot of trying and research I found the reason: http://www.haskell.org/haskellwiki/Xmonad/General_xmonad.hs_config_tips

Quote:gnome-terminal by default starts a single back-end "factory" and spawns terminal windows from it; all of these windows will share the same resource name and class. Use the --disable-factory option with --name= or --class= to ensure that the created window is not shared with unrelated terminals.

Other terminal emulators for Gnome and KDE are likely to behave similarly. (Konsole does not, at least as of this writing; but it does send itself to the background, which will break XMonad.Actions.SpawnOn unless you use the --nofork option.) Look for options to disable shared sessions or factories.

(06-24-2013, 07:37 PM)noize Wrote: Also, I just logged in and new panes opened up fine, but after typing this, I tried opening up Terminal in another workspace and (also any other program does the same) it overlaps the top and bottom Gnome bars completely.

Use avoidStruts:

Code:
layoutHook = onWorkspace "web" (avoidStruts myLayoutWeb) $ onWorkspace "coding" (avoidStruts myLayoutCoding) $ avoidStruts myLayout

Where should I add the --disable-factory option exactly?


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

How about this solution:

Instead of using spawnOn, just spawn the program at the startupHook and set the workspace in the manageHook.

Example (tested and works for me):

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 import XMonad.Actions.GridSelect import XMonad.Layout.Fullscreen myNormalBorderColor = "#cccccc" myFocusedBorderColor = "#0000ff" myManageHook = composeAll [ (className =? "Firefox" <&&> resource =? "Dialog") --> doFloat , className =? "Thunderbird" --> doShift "mail" , className =? "Firefox" --> doShift "web" , manageDocks ] main = do xmonad $ gnomeConfig { manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig , handleEventHook = fullscreenEventHook , startupHook = do spawn "thunderbird" spawn "firefox" }



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

Thanks, it worked finestly. Now my XMonad is pretty much as I want it, fuck all dynamic WMs, it'll probably become my main working environment.

My current config 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.Actions.GridSelect import XMonad.Layout.Fullscreen import XMonad.Layout.PerWorkspace import System.IO myNormalBorderColor = "#cccccc" myFocusedBorderColor = "#0000ff" myManageHook = composeAll [ className =? "Firefox" --> doShift "web" , manageDocks ] myLayoutMain = 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 = 1/100 myLayoutDefault = tiled ||| Mirror tiled ||| Full where tiled = Tall nmaster delta ratio nmaster = 2 ratio = 3/5 delta = 1/100 myLayoutWeb = Mirror tiled ||| tiled ||| Full where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 3/4 delta = 1/100 myLayoutCoding = tiled ||| Mirror tiled ||| Full where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 1/2 delta = 1/100 main = do xmonad $ gnomeConfig { manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig , handleEventHook = fullscreenEventHook , startupHook = do spawn "gnome-terminal" spawn "firefox" , layoutHook = onWorkspace "main" (avoidStruts myLayoutMain) $ onWorkspace "web" (avoidStruts myLayoutWeb) $ onWorkspace "coding" (avoidStruts myLayoutCoding) $ avoidStruts myLayoutDefault , workspaces = ["main","web","coding","hacking","testing","6","7","8","9"] , modMask = mod4Mask , normalBorderColor = myNormalBorderColor , focusedBorderColor = myFocusedBorderColor }`additionalKeys` [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s") , ((0, xK_Print), spawn "scrot") ]

This thread became pretty much overflowing with XMonad knowledge, lol.

I'd have just a couple of questions more.

1. What does this do exactly?

Code:
(className =? "Firefox" <&&> resource =? "Dialog") --> doFloat

2. Where was I supposed to put that option about something-fabric?

3. Is there a way to shift a program to a workspace (for instance, spawning Firefox under the "web" workspace) just on startup (when I run Firefox, it always goes to "web" automatically)?

Edit: while using XMonad with Gnome, since a couple of xmonad.hs edits ago or something like that, it seems like I can't anymore switch between workspaces by clicking on their respective bottom right squares.


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

(06-25-2013, 09:46 PM)noize Wrote: 1. What does this do exactly?

Code:
(className =? "Firefox" <&&> resource =? "Dialog") --> doFloat

Every dialog box of firefox shall float instead of being a tiled window like the others.

(06-25-2013, 09:46 PM)noize Wrote: 2. Where was I supposed to put that option about something-fabric?

That's an option of gnome-terminal. You would have to put that option somewhere in the config files.
Maybe you can use gconf-editor > apps > gnome-terminal to add the option. You will have to install gconf-editor for this, though.

Quote:3. Is there a way to shift a program to a workspace (for instance, spawning Firefox under the "web" workspace) just on startup (when I run Firefox, it always goes to "web" automatically)?

Using spawnOn would have been the way.

Quote:Edit: while using XMonad with Gnome, since a couple of xmonad.hs edits ago or something like that, it seems like I can't anymore switch between workspaces by clicking on their respective bottom right squares.

You are right. Now that you mention it, I realize it doesn't work for me too.
I can't tell you why, though.
I don't use the mouse much anyway. At least not in xmonad.


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

(06-26-2013, 09:03 AM)Deque Wrote:
(06-25-2013, 09:46 PM)noize Wrote: 1. What does this do exactly?

Code:
(className =? "Firefox" <&&> resource =? "Dialog") --> doFloat

Every dialog box of firefox shall float instead of being a tiled window like the others.

But, to me it looks just like the others.

Quote:
Quote:Edit: while using XMonad with Gnome, since a couple of xmonad.hs edits ago or something like that, it seems like I can't anymore switch between workspaces by clicking on their respective bottom right squares.

You are right. Now that you mention it, I realize it doesn't work for me too.
I can't tell you why, though.
I don't use the mouse much anyway. At least not in xmonad.

Yeah, I don't use the mouse much either, but I can tell you why.

Code:
{ manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig , handleEventHook = fullscreenEventHook

Just change the above part with:

Code:
xmonad $ gnomeConfig { manageHook = myManageHook <+> manageHook gnomeConfig

As I've seen those "fullscreen" stuff, I just thought it had to be something set to widescreen overlapping the touch over there. It looks like working this way too:

Code:
xmonad $ gnomeConfig { manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig

You just needed to remove "handleEventHook = fullscreenEventHook".

Would you might explaining to me what all of this does exactly and what changes (apart from the fact this way I can switch between workspaces with a click too) ? I think something should differ as long as in the latest versions of the code you provided this was different from the earlier versions.

Also a minor thing, if I switch gedit to widescreen with F11, it can't seem to be able to get back to normal, was just curious to know if you did know what causes this.


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

(06-26-2013, 10:29 AM)noize Wrote:
(06-26-2013, 09:03 AM)Deque Wrote: Every dialog box of firefox shall float instead of being a tiled window like the others.

But, to me it looks just like the others.

Works fine for me. See the dialog box here, it is not tiled:

[Image: gw6g8gr3.png]


Quote:Yeah, I don't use the mouse much either, but I can tell you why.

Code:
{ manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig , handleEventHook = fullscreenEventHook

Just change the above part with:

Code:
xmonad $ gnomeConfig { manageHook = myManageHook <+> manageHook gnomeConfig

As I've seen those "fullscreen" stuff, I just thought it had to be something set to widescreen overlapping the touch over there. It looks like working this way too:

Code:
xmonad $ gnomeConfig { manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig

You just needed to remove "handleEventHook = fullscreenEventHook".

Would you might explaining to me what all of this does exactly and what changes (apart from the fact this way I can switch between workspaces with a click too) ? I think something should differ as long as in the latest versions of the code you provided this was different from the earlier versions.

Also a minor thing, if I switch gedit to widescreen with F11, it can't seem to be able to get back to normal, was just curious to know if you did know what causes this.

Interesting.
Removing widescreen from Gedit works fine for me and I still have the xmonad.hs unchanged (with both, fullscreenEventHook and fullscreenManageHook). I suppose that removing the fullScreenEventHook causes this.

I put these in, because I realized that I wasn't able to watch any youtube videos properly in fullscreen without them.
I got the information from the Xmonad documentation: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-Fullscreen.html
What's written there is all I know.

Maybe I have to add the fullscreenFull modifier to the layout too. Not sure, I will try later.


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

(06-26-2013, 07:15 PM)Deque Wrote:
(06-26-2013, 10:29 AM)noize Wrote:
(06-26-2013, 09:03 AM)Deque Wrote: Every dialog box of firefox shall float instead of being a tiled window like the others.

But, to me it looks just like the others.

Works fine for me. See the dialog box here, it is not tiled:

[Image: gw6g8gr3.png]

Yeah, no, this works for me too, you're right.

Quote:
Quote:Yeah, I don't use the mouse much either, but I can tell you why.

Code:
{ manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig , handleEventHook = fullscreenEventHook

Just change the above part with:

Code:
xmonad $ gnomeConfig { manageHook = myManageHook <+> manageHook gnomeConfig

As I've seen those "fullscreen" stuff, I just thought it had to be something set to widescreen overlapping the touch over there. It looks like working this way too:

Code:
xmonad $ gnomeConfig { manageHook = fullscreenManageHook <+> myManageHook <+> manageHook gnomeConfig

You just needed to remove "handleEventHook = fullscreenEventHook".

Would you might explaining to me what all of this does exactly and what changes (apart from the fact this way I can switch between workspaces with a click too) ? I think something should differ as long as in the latest versions of the code you provided this was different from the earlier versions.

Also a minor thing, if I switch gedit to widescreen with F11, it can't seem to be able to get back to normal, was just curious to know if you did know what causes this.

Interesting.
Removing widescreen from Gedit works fine for me and I still have the xmonad.hs unchanged (with both, fullscreenEventHook and fullscreenManageHook). I suppose that removing the fullScreenEventHook causes this.

I put these in, because I realized that I wasn't able to watch any youtube videos properly in fullscreen without them.
I got the information from the Xmonad documentation: http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Layout-Fullscreen.html
What's written there is all I know.

Maybe I have to add the fullscreenFull modifier to the layout too. Not sure, I will try later.

Are you able to still watch them properly by removing any of those two elements? Or do you need both of them to do so?