You are not logged in.

#1 2016-11-25 05:05:55

reddhawk
Member
Registered: 2012-07-02
Posts: 28

[SOLVED] xmonad and 10 desktops from 0 to 9

Hi guys,

Hope today someone will be able to help me with xmonad and some haskell!

I mainly have 2 problems:

1) These icons:
339wrp08hTPp.png
are my workspace icons on my dzen bar and are not changing workspace if you click them.

2) I defined 10 workspaces and I'd like to move among them doing

alt+[1,2,3,4,5,6,7,8,9,0]

or, alternatively

alt+[0,1,2,3,4,5,6,7,8,9]

ideas?

This is my config: (unfortunately I don't know haskell and I made it by looking other configs and trying to figure out stuff)

import XMonad
-- LAYOUTS
import XMonad.Layout
import XMonad.Layout.IM as IM
import XMonad.Layout.Named
import XMonad.Layout.OneBig
import XMonad.Layout.Master
import XMonad.Layout.Reflect
import XMonad.Layout.MosaicAlt
import XMonad.Layout.NoBorders (noBorders,smartBorders,withBorder)
import XMonad.Layout.ResizableTile
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Minimize
import XMonad.Layout.Grid
import XMonad.Layout.Spacing
import XMonad.Layout.Fullscreen 
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Tabbed
import XMonad.Layout.Circle
import XMonad.Layout.Spiral
-- WINDOW RULES
import XMonad.ManageHook
-- KEYBOARD & MOUSE CONFIG
import XMonad.Util.EZConfig
import XMonad.Actions.FloatKeys
import Graphics.X11.ExtraTypes.XF86
-- STATUS BAR
import XMonad.Hooks.DynamicLog hiding (xmobar, xmobarPP, xmobarColor, sjanssenPP, byorgeyPP)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Util.Dmenu
--import XMonad.Hooks.FadeInactive
import XMonad.Hooks.EwmhDesktops hiding (fullscreenEventHook)
import System.IO (hPutStrLn)
--import XMonad.Operations
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import qualified XMonad.Actions.FlexibleResize as FlexibleResize
import XMonad.Util.SpawnOnce
import XMonad.Util.Run (spawnPipe)
import XMonad.Actions.CycleWS			-- nextWS, prevWS
import Data.List			-- clickable workspaces
import System.Exit

myTerminal				= "urxvt"
inTerminal cmd			= myTerminal ++ " -e bash -c " ++ cmd
inTerminalName name cmd	= myTerminal ++ " -T " ++ name ++ " -e " ++ cmd

myAudioSettings			= "alsamixer"
myAudioSettingsTitle	= "alsamixer"
alsamixer				= inTerminalName myAudioSettingsTitle myAudioSettings

myMusicPlayer		= "mocp"
myMusicPlayerTitle	= "mocp"
myMusicTerm			= inTerminalName myMusicPlayerTitle myMusicPlayer

myFileManager		= "ranger"
myFileTerm			= inTerminal myFileManager

myInteractiveProcesses	= "htop"
htop					= inTerminal myInteractiveProcesses

myWiFi				= "'sudo rfkill unblock all && sudo ip link set wlp6s0 up && sudo wifi-menu wlp6s0 && sleep 1'"
myWiFiTitle			= "wifi-menu"
wifimenu			= inTerminalName myWiFiTitle myWiFi

--------------------------------------------------------------------------------------------------------------------
-- STARTUP PROGRAMS
--------------------------------------------------------------------------------------------------------------------

startup :: X ()
startup = do
	spawnOnce "./.fehbg"

--------------------------------------------------------------------------------------------------------------------
-- DECLARE WORKSPACES RULES
--------------------------------------------------------------------------------------------------------------------

myTile			= named "T"				$ ResizableTall 1 0.03 0.5 []
myTileSpace 	= named "Ts"			$ spacing 20 $ ResizableTall 1 0.03 0.5 []
myMirr			= named "mT"			$ Mirror myTile
myMirrSpace		= named "mTs"			$ Mirror myTileSpace
myGrid			= named "G"				$ Grid
myGridSpace 	= named "Gs"			$ spacing 20 $ Grid
myMosA			= named "M"				$ MosaicAlt M.empty
myWebMosA		= named "wM"			$ reflectHoriz $ withIM (0.30) (Title "wifi-menu") $ myMosA
myObig			= named "O"				$ OneBig 0.75 0.65
myFull			= named "F"				$ noBorders $ Full
myMusic			= named "Music"			$ noBorders $ reflectHoriz $ withIM (0.24) (Title "alsamixer") Full
myGimp			= named "Gimp"			$ noBorders $ withIM (0.13) (Role "gimp-toolbox") $ reflectHoriz $ withIM (0.15) (Role "gimp-dock") Full
mySkypeFull		= named "Skype Full"	$ noBorders $ withIM (0.24) (Title "your.username - Skype™") Full
mySkypeMosA		= named "Skype MosA"	$ noBorders $ withIM (0.24) (Title "your.username - Skype™") $ (myTile ||| myMirr)
myGames			= named "Games" 		$ noBorders(fullscreenFull Full)
myChat			= named "Chat"  		$ withIM (0.18) (Title "Lista contatti") $ (ResizableTall 1 0.03 0.5 [] ||| myFull)
mySpiral		= named "Spiral"		$ spiral (6/7)


myLayout = id
	$ avoidStrutsOn [U]
	$ onWorkspace (myWorkspaces !! 1)	webLayouts
	$ onWorkspace (myWorkspaces !! 2)	termLayouts
	$ onWorkspace (myWorkspaces !! 3)	dirsLayouts
	$ onWorkspace (myWorkspaces !! 4)	musicLayouts
	$ onWorkspace (myWorkspaces !! 5)	gimpLayouts
	$ onWorkspace (myWorkspaces !! 6)	gamesLayouts
	$ onWorkspace (myWorkspaces !! 7)	chatLayouts
	$ allLayouts
	where
		allLayouts		= myTile ||| myTileSpace ||| myGrid ||| myGridSpace ||| myMirr ||| myMirrSpace ||| myMosA ||| myObig ||| myGrid ||| myFull ||| mySpiral
		webLayouts		= myWebMosA ||| myFull
		termLayouts		= myGrid ||| myTile ||| myTileSpace ||| myMirr ||| myObig
		dirsLayouts     = myTile ||| myMirr ||| myMosA ||| myFull
		musicLayouts	= myMusic ||| myMosA
		gimpLayouts		= myGimp ||| myFull
		gamesLayouts	= myGames ||| myGridSpace
		chatLayouts		= myChat ||| mySkypeFull ||| mySkypeMosA ||| myFull ||| myTileSpace

--------------------------------------------------------------------------------------------------------------------
-- WORKSPACE DEFINITIONS
--------------------------------------------------------------------------------------------------------------------

myWorkspaces = clickable $ [ 
	 "^i(/home/damiano/.xmonad/dzen2/arch_10x10.xbm)"
	,"^i(/home/damiano/1.xbm)"
	,"^i(/home/damiano/2.xbm)"
	,"^i(/home/damiano/3.xbm)"
	,"^i(/home/damiano/4.xbm)"
	,"^i(/home/damiano/5.xbm)"
	,"^i(/home/damiano/6.xbm)"
	,"^i(/home/damiano/7.xbm)"
	,"^i(/home/damiano/8.xbm)"
	,"^i(/home/damiano/9.xbm)"
	]
								
	where clickable l = [ "^ca(1,xdotool key alt+" ++ show (n) ++ ")" ++ ws ++ "^ca()" |
				(i,ws) <- zip [1..] l,
				let n = i ]

--------------------------------------------------------------------------------------------------------------------
-- APPLICATION SPECIFIC RULES
--------------------------------------------------------------------------------------------------------------------
myManageHook :: ManageHook
myManageHook = composeAll $
				[ isFullscreen                   				--> doFullFloat
				, isDialog                       				--> doCenterFloat
				, resource =? "vlc"								--> doFloat
				, resource =? "dzen2"							--> doIgnore
				, resource =? "tixati"							--> doShift (myWorkspaces !! 9)
				, manageDocks]
				++ [resource =? ("atWorkspace" ++ s) --> doShift s 
				| s <- map show [0..9]]


--------------------------------------------------------------------------------------------------------------------
-- DZEN LOG RULES for workspace names, layout image, current program title
--------------------------------------------------------------------------------------------------------------------
myLogHook h = dynamicLogWithPP ( defaultPP
	{
		  ppCurrent		= dzenColor color2 background .	pad
		, ppVisible		= dzenColor color6 background . 	pad
		, ppHidden		= dzenColor color12 background . 	pad
		, ppHiddenNoWindows	= dzenColor color8 background .	pad
		, ppWsSep		= ""
		, ppSep			= "    "
		, ppLayout		= wrap "^ca(1,xdotool key alt+space)" "^ca()" . dzenColor color1 background .
				(\x -> case x of
					"F"				->	"^i(/home/damiano/.xmonad/dzen2/layout_full.xbm)"
					"T"				->	"^i(/home/damiano/.xmonad/dzen2/layout_tall.xbm)"
					"Ts"			->	"^i(/home/damiano/.xmonad/dzen2/layout_tall.xbm)"
					"mT"			->  "^i(/home/damiano/.xmonad/dzen2/layout_mirror_tall.xbm)"
					"mTs"			->  "^i(/home/damiano/.xmonad/dzen2/layout_mirror_tall.xbm)"
					"G"				->	"^i(/home/damiano/.xmonad/dzen2/grid.xbm)"
					"Gs"			->	"^i(/home/damiano/.xmonad/dzen2/grid.xbm)"
					"M"				->  "^i(/home/damiano/.xmonad/dzen2/mosa.xbm)"
					"wM"			->  "^i(/home/damiano/.xmonad/dzen2/mosa.xbm)"
					"O"				->  "^i(/home/damiano/.xmonad/dzen2/onebig.xbm)"
					_				->  ""
				) 
		, ppOrder	=  \(ws:l:t:_) -> [ws,l, t]
		, ppOutput	=   hPutStrLn h
	} )


--------------------------------------------------------------------------------------------------------------------
-- Spawn pipes and menus on boot, set default settings
--------------------------------------------------------------------------------------------------------------------
myXmonadBar = "dzen2 -e '' -x '0' -y '0' -h '24' -w '1920' -ta 'l' -fg '"++foreground++"' -bg '"++background++"' -fn "++myFont

main = do
	dzenLeftBar 	<- spawnPipe myXmonadBar

	xmonad $ ewmh defaultConfig
		{ terminal		= myTerminal
		, borderWidth		= 1
		, normalBorderColor 	= background
		, focusedBorderColor  	= color8
		, modMask 		= mod1Mask
		, layoutHook 		= smartBorders $ myLayout
		, workspaces 		= myWorkspaces
		, manageHook		= myManageHook
		, handleEventHook 	= fullscreenEventHook <+> docksEventHook
		, startupHook		= setWMName "LG3D"
		, logHook		= myLogHook dzenLeftBar -- >> fadeInactiveLogHook 0xdddddddd
		}

--------------------------------------------------------------------------------------------------------------------
-- Keyboard options
--------------------------------------------------------------------------------------------------------------------

			`additionalKeys`
		[((mod1Mask .|. shiftMask, 		xK_Return	), spawn $ myTerminal)
		,((mod1Mask .|. shiftMask, 		xK_p		), spawn "dmenu_run -b -fn 'Inconsolata-10'")
		,((mod1Mask .|. shiftMask, 		xK_c		), kill)
		,((mod1Mask .|. shiftMask, 		xK_g		), spawn "chromium")
		,((mod1Mask .|. controlMask, 	xK_f		), spawn $ myFileTerm)
		,((mod1Mask .|. shiftMask, 		xK_l		), spawn "xscreensaver-command --lock")
		,((mod1Mask .|. controlMask, 	xK_w		), spawn $ wifimenu)
		,((mod1Mask .|. shiftMask, 		xK_h		), spawn $ htop)
		,((controlMask, xF86XK_AudioPlay			), spawn $ myMusicTerm)
		,((controlMask, xF86XK_AudioMute			), spawn $ alsamixer)
		,((0,   xF86XK_AudioRaiseVolume				), spawn "amixer sset Master 5%+")
		,((0,   xF86XK_AudioLowerVolume				), spawn "amixer sset Master 5%-")
		,((0,   xF86XK_AudioMute					), spawn "amixer -q sset Master toggle")
		,((0, 	xF86XK_AudioNext					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")
		,((0, 	xF86XK_AudioPrev					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")
		,((0, 	xF86XK_AudioPlay					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")
		,((mod1Mask,					xK_space    ), sendMessage NextLayout)
		,((mod1Mask,					xK_n        ), refresh)
		,((mod1Mask,					xK_Tab      ), windows W.focusDown)
		,((mod1Mask,					xK_j        ), windows W.focusDown)
		,((mod1Mask,					xK_k        ), windows W.focusUp  )
		,((mod1Mask,					xK_m        ), windows W.focusMaster  )
		,((mod1Mask .|. shiftMask, 		xK_m        ), windows W.swapMaster)
		,((mod1Mask .|. shiftMask, 		xK_j        ), windows W.swapDown  )
		,((mod1Mask .|. shiftMask, 		xK_k        ), windows W.swapUp    )
		,((mod1Mask,					xK_h        ), sendMessage Shrink)
		,((mod1Mask,					xK_l        ), sendMessage Expand)
		,((mod1Mask,					xK_t        ), withFocused $ windows . W.sink)
		,((mod1Mask,					xK_comma    ), sendMessage (IncMasterN 1))
		,((mod1Mask, 					xK_period   ), sendMessage (IncMasterN (-1)))
		,((mod1Mask .|. shiftMask, 		xK_q        ), do
					-- spawn "" 
					io (exitWith ExitSuccess)) -- GEEK :D
		]
		
--		`additionalMouseBindings`
--		[((mod1Mask			, 6), (\_ -> moveTo Next NonEmptyWS))
--		,((mod1Mask			, 7), (\_ -> moveTo Prev NonEmptyWS))
--		,((mod1Mask			, 5), (\_ -> moveTo Prev NonEmptyWS))
--		,((mod1Mask			, 4), (\_ -> moveTo Next NonEmptyWS))
--		,((0				, 2), (\w -> focus w >> windows W.swapMaster))
--		,((0				, 3), (\w -> focus w >> FlexibleResize.mouseResizeWindow w))
--		]

myMouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
  [
    -- mod-button1, Set the window to floating mode and move by dragging
    ((modMask, button1),
     (\w -> focus w >> mouseMoveWindow w))

    -- mod-button2, Raise the window to the top of the stack
    , ((modMask, button2),
       (\w -> focus w >> windows W.swapMaster))

    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modMask, button3),
       (\w -> focus w >> mouseResizeWindow w))

    -- you may also bind events to the mouse scroll wheel (button4 and button5)
  ]

------------------------------------------------------------------------

-- Define constants

myBitmapsDir	= "~/.xmonad/dzen2/"

--myFont 		= "-*-tamsyn-medium-r-normal-*-12-87-*-*-*-*-*-*"
--myFont		= "-*-terminus-medium-*-normal-*-9-*-*-*-*-*-*-*"
--myFont		= "-*-nu-*-*-*-*-*-*-*-*-*-*-*-*"
--myFont			= "-artwiz-lime-medium-r-normal-*-10-110-75-75-m-50-iso8859-*"
--myFont			= "-artwiz-limey-medium-r-normal-*-10-110-75-75-m-50-iso8859-*"
--myFont		= "-benis-lemon-medium-r-normal-*-10-110-75-75-m-50-iso8859-*"
--myFont		= "'sans:italic:bold:underline'"
myFont		= "xft:inconsolata:size=10"
--myFont		= "xft:Droxd Sans:size=12"
--myFont		= "-*-cure-*-*-*-*-*-*-*-*-*-*-*-*"

background= "#202020"
foreground= "#DBDCDC"

color0= "#656565"
color8= "#868686"

color1= "#FFFFFF"
color9= "#FFFFFF"

color2= "#80D468"
color10= "#A3F2A0"

color3= "#D7A169"
color11= "#F5CDA2"

color4= "#6985D7"
color12= "#A2C1F5"

color5= "#C86AD4"
color13= "#D2A2F5"

color6= "#6FCCD1"
color14= "#A0E9F2"

color7= "#DBDCDC"
color15= "#FDFDFD"

Last edited by reddhawk (2016-11-28 17:34:11)

Offline

#2 2016-11-28 17:32:25

reddhawk
Member
Registered: 2012-07-02
Posts: 28

Re: [SOLVED] xmonad and 10 desktops from 0 to 9

SOLVED

import XMonad
import XMonad.ManageHook
-- HOOKS
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.DynamicLog hiding (xmobar, xmobarPP, xmobarColor, sjanssenPP, byorgeyPP)
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.EwmhDesktops hiding (fullscreenEventHook)
-- LAYOUTS
import XMonad.Layout
import XMonad.Layout.IM as IM
import XMonad.Layout.Named
import XMonad.Layout.OneBig
import XMonad.Layout.Master
import XMonad.Layout.Reflect
import XMonad.Layout.MosaicAlt
import XMonad.Layout.NoBorders (noBorders,smartBorders,withBorder)
import XMonad.Layout.ResizableTile
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Minimize
import XMonad.Layout.Grid
import XMonad.Layout.Spacing
import XMonad.Layout.Fullscreen 
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Tabbed
import XMonad.Layout.Circle
import XMonad.Layout.Spiral
import XMonad.Layout.Magnifier
import XMonad.Layout.LayoutBuilder

import XMonad.Util.EZConfig
import XMonad.Util.Dmenu
import XMonad.Util.Dzen
import XMonad.Util.SpawnOnce
import XMonad.Util.Run (spawnPipe)

import XMonad.Actions.CycleWS			-- nextWS, prevWS
import XMonad.Actions.FloatKeys
import Graphics.X11.ExtraTypes.XF86

import System.IO (hPutStrLn)
import Control.Monad.Writer
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
import qualified XMonad.Actions.FlexibleResize as FlexibleResize
import Data.List						-- clickable workspaces
import System.Exit
 
---------------------------------------------------------------------------------------------------------------------------------
-- DEFINING VARIABLES
---------------------------------------------------------------------------------------------------------------------------------

-- modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt").  You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
-- NOTE: from 0.9.1 on numlock mask is set automatically. The numlockMask
-- setting should be removed from configs.
--
-- You can safely remove this even on earlier xmonad versions unless you
-- need to set it to something other than the default mod2Mask, (e.g. OSX).
--
-- The mask for the numlock key. Numlock status is "masked" from the
-- current modifier status, so the keybindings will work with numlock on or
-- off. You may need to change this on some systems.
--
-- You can find the numlock modifier by running "xmodmap" and looking for a
-- modifier with Num_Lock bound to it:
--
-- > $ xmodmap | grep Num
-- > mod2        Num_Lock (0x4d)
--
-- Set numlockMask = 0 if you don't have a numlock key, or want to treat
-- numlock status separately.
--
-- myNumlockMask   = mod2Mask -- deprecated in xmonad-0.9.1

myModMask				=	mod1Mask

-- Whether focus follows the mouse pointer.

myFocusFollowsMouse	:: Bool
myFocusFollowsMouse		=	True
 
-- Width of the window border in pixels.

myBorderWidth			=	1

myTerminal				=	"urxvt"
inTerminal cmd			=	myTerminal ++ " -e bash -c " ++ cmd
-- FIX THIS LINE UNDER HERE, IT WAS FOR TERMINATOR ONCE
inTerminalName name cmd	=	myTerminal ++ " -T " ++ name ++ " -e " ++ cmd

myAudioSettings			=	"alsamixer"
myAudioSettingsTitle	=	"alsamixer"
alsamixer				=	inTerminalName myAudioSettingsTitle myAudioSettings

myMusicPlayer			=	"mocp"
myMusicPlayerTitle		=	"mocp"
myMusicTerm				=	inTerminalName myMusicPlayerTitle myMusicPlayer

myFileManager			=	"ranger"
myFileTerm				=	inTerminal myFileManager

myInteractiveProcesses	=	"htop"
htop					=	inTerminal myInteractiveProcesses

myWiFiDevice			=	"wlp6s0"
myWiFi					=	"'sudo rfkill unblock all && sudo ip link set "++myWiFiDevice++" up && sudo wifi-menu "++myWiFiDevice++" && sleep 1'"
myWiFiTitle				=	"wifi-menu"
wifimenu				=	inTerminalName myWiFiTitle myWiFi

myHomeFolder 			=	"/home/damiano"
myBitmapsDir			=	myHomeFolder++"/.xmonad/dzen2/"
myScriptDir				=	myHomeFolder++"/.xmonad/scripts/"
myShutdownMenu			=	myScriptDir++"pop-up"

-- Here's basically the key layout I'm using to move on my workspaces.
-- 0 corresponds to the fisrt workspace. If you want to make it the last, just change the position in the array below. 

numPadKeys				=	[ xK_KP_Insert									-- 0
							, xK_KP_End,  xK_KP_Down,  xK_KP_Page_Down 		-- 1, 2, 3
							, xK_KP_Left, xK_KP_Begin, xK_KP_Right			-- 4, 5, 6
							, xK_KP_Home, xK_KP_Up,    xK_KP_Page_Up ]		-- 7, 8, 9

numKeys					=	[ xK_0, xK_1, xK_2, xK_3, xK_4, xK_5, xK_6, xK_7, xK_8, xK_9]					

---------------------------------------------------------------------------------------------------------------------------------
-- Aesthetics 美学
---------------------------------------------------------------------------------------------------------------------------------

myFont		= "-artwiz-anorexia-medium-r-normal--15-110-75-75-p-0-iso8859-1"

background= "#202020"
foreground= "#DBDCDC"

color0= "#656565"
color8= "#868686"

color1= "#FFFFFF"
color9= "#FFFFFF"

color2= "#80D468"
color10= "#A3F2A0"

color3= "#D7A169"
color11= "#F5CDA2"

color4= "#6985D7"
color12= "#A2C1F5"

color5= "#C86AD4"
color13= "#D2A2F5"

color6= "#6FCCD1"
color14= "#A0E9F2"

color7= "#DBDCDC"
color15= "#FDFDFD"

---------------------------------------------------------------------------------------------------------------------------------
-- WORKSPACE DEFINITION
---------------------------------------------------------------------------------------------------------------------------------

-- The default number of workspaces (virtual screens) and their names.
-- By default we use numeric strings, but any string may be used as a
-- workspace name. The number of workspaces is determined by the length
-- of this list.

myWorkspaces = clickable $ [
	 "^i("++myBitmapsDir++"arch_10x10.xbm)"
	,"^i("++myBitmapsDir++"1.xbm)"
	,"^i("++myBitmapsDir++"2.xbm)"
	,"^i("++myBitmapsDir++"3.xbm)"
	,"^i("++myBitmapsDir++"4.xbm)"
	,"^i("++myBitmapsDir++"5.xbm)"
	,"^i("++myBitmapsDir++"6.xbm)"
	,"^i("++myBitmapsDir++"7.xbm)"
	,"^i("++myBitmapsDir++"8.xbm)"
	,"^i("++myBitmapsDir++"9.xbm)"
	]
		where clickable l = [ "^ca(1,xdotool key alt+" ++ show (n) ++ ")" ++ ws ++ "^ca()" | (i,ws) <- zip [0,1,2,3,4,5,6,7,8,9] l, let n = if i == 10 then 0 else i ]
 
---------------------------------------------------------------------------------------------------------------------------------
-- APPLICATION OF SPECIFIC RULES
---------------------------------------------------------------------------------------------------------------------------------
-- Window rules:
--
-- Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
-- > xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
-- To match on the WM_NAME, you can use 'title' in the same way that
-- 'className' and 'resource' are used below.
--
-- The following code is a script you can use to get info in a format usable for xmonad from your apps.
--
-- #! /bin/sh
-- exec xprop -notype \
--  -f WM_NAME        8s ':\n  title =\? $0\n' \
--  -f WM_CLASS       8s ':\n  appName =\? $0\n  className =\? $1\n' \
--  -f WM_WINDOW_ROLE 8s ':\n  stringProperty "WM_WINDOW_ROLE" =\? $0\n' \
--  WM_NAME WM_CLASS WM_WINDOW_ROLE \
--  ${1+"$@"}

myManageHook ::  ManageHook
myManageHook = composeAll . concat $ [
	  [ isDialog		--> 	doCenterFloat ]
	, [(className =? c <||> title =? c <||> resource =? c) --> doIgnore							| c <- bars		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doFloat							| c <- float	]
	, [(className =? c <||> title =? c <||> resource =? c) --> doCenterFloat					| c <- cfloat	]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 1)		| c <- 一		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 2)		| c <- 二		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 3)		| c <- 三		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 4)		| c <- 四		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 5)		| c <- 五		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 6)		| c <- 六		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 7)		| c <- 七		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 8)		| c <- 八		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 9)		| c <- 九		]
	, [(className =? c <||> title =? c <||> resource =? c) --> doShift (myWorkspaces !! 0)		| c <- 零		]
--	, [ role 	  =? c 	-->		doFloat															| c <- 零		]
    ]
    where    
		bars		=	["xmobar","dzen2","desktop_window"]
		float		=	["feh"]
		cfloat		=	["Xmessage","Gxmessage","Eog","Xscreensaver-demo","xclock","Xscreensaver-demo","xfreerdp"]
--					++	[]
		零		=	[]
		一		=	[]
		二		=	[]
		三		=	[]
		四		=	[]
		五		=	[]
		六		=	[]
		七		=	[]
		八		=	[]
		九		=	[]
--		role		=	stringProperty "WM_WINDOW_ROLE"

---------------------------------------------------------------------------------------------------------------------------------
-- DEFINING LAYOUTS
---------------------------------------------------------------------------------------------------------------------------------
-- Layouts:
--
-- You can specify and transform your layouts by modifying these values.
-- If you change layout bindings be sure to use 'mod-shift-space' after
-- restarting (with 'mod-q') to reset your layout state to the new
-- defaults, as xmonad preserves your old layout settings by default.
--
-- * NOTE: XMonad.Hooks.EwmhDesktops users must remove the obsolete
-- ewmhDesktopsLayout modifier from layoutHook. It no longer exists.
-- Instead use the 'ewmh' function from that module to modify your
-- defaultConfig as a whole. (See also logHook, handleEventHook, and
-- startupHook ewmh notes.)
--
-- The available layouts.  Note that each layout is separated by |||,
-- which denotes layout choice.


myTile			= named "T"				$ ResizableTall 1 0.03 0.5 []
myTileSpace 	= named "Ts"			$ spacing 15 $ ResizableTall 1 0.03 0.5 []
myMirr			= named "mT"			$ Mirror myTile
myMirrSpace		= named "mTs"			$ Mirror myTileSpace
myGrid			= named "G"				$ Grid
myGridSpace 	= named "Gs"			$ spacing 15 $ Grid
myMagnifier		= named "Gm"			$ magnifiercz 2 $ Grid
myMosA			= named "M"				$ MosaicAlt M.empty
myWebMosA		= named "wM"			$ reflectHoriz $ withIM (0.30) (Title "wifi-menu") $ myMosA
myObig			= named "O"				$ OneBig (3/4) (3/4)
mySpiral		= named "S"				$ spiral (6/7)
--myNigga			= named "N"				$ layoutN 1 (relBox 0 0 0.5 1) (Just $ relBox 0 0 1 1) Full $ layoutN 1 (relBox 0.5 0 1 0.5) (Just $ relBox 0.5 0 1 1) Full $ layoutAll (relBox 0.5 0.5 1 1) simpleTabbed

myLayout = id
	$ avoidStrutsOn [U,D]
	$ onWorkspace (myWorkspaces !! 1)	allLayouts
	$ onWorkspace (myWorkspaces !! 2)	webLayouts
	$ onWorkspace (myWorkspaces !! 3)	termLayouts
	$ onWorkspace (myWorkspaces !! 4)	gamesLayouts
	$ allLayouts
	where
		allLayouts		= myGrid
		webLayouts		= myTile ||| myGrid ||| myObig ||| myWebMosA
		termLayouts		= myObig ||| myTile ||| myGrid
		gamesLayouts	= myGrid ||| myObig

---------------------------------------------------------------------------------------------------------------------------------
-- KEY BINDINGS
---------------------------------------------------------------------------------------------------------------------------------
-- Add, modify or remove key bindings here.
--
-- The following command is something you might wanna use if you need to find out key codes on your keyboard
--
-- xev | grep keycodes
--
-- WARNING: the command above filters the output but won't let you see mouse clicks and some other stuff.
--          Just run xev for a complete output.
--
-- NOTE: in order to make my dmenu commands work for you, you need to have your DMENU patched with this:
-- http://tools.suckless.org/dmenu/patches/xyw
--
-- You can either do that or install "dmenu-xft-wxy-mouse" or "dmenu-xyw-mouse-mse" from AUR.
-- Also, you'll need to have the dmenu_path script in your /bin folder. It can be found in your /bin if you have a vanilla dmenu.

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
	-- Launch a terminal
	[((modm .|. shiftMask, 		xK_Return	), spawn $ myTerminal)
    -- Launch dmenu
	,((modm .|. shiftMask, 		xK_p		), spawn "dmenu_path | dmenu -y 1060 -fn 'Inconsolata-11' \"$@\" | ${SHELL:-'/bin/sh'} &")
	-- Show my shutdown custom-built menu
	,((modm .|. shiftMask, 		xK_s		), spawn $ myShutdownMenu )
    -- Close focused window
	,((modm .|. shiftMask, 		xK_c		), kill)
	-- Launch Chromium
	,((modm .|. shiftMask, 		xK_g		), spawn $ "chromium")
	-- Spawn your in-terminal file manager
	,((modm .|. controlMask, 	xK_f		), spawn $ myFileTerm)
	-- Lock your screen
	,((modm .|. shiftMask, 		xK_l		), spawn "xscreensaver-command --lock")
	-- Launch wifi-menu in a new terminal window
	,((modm .|. controlMask, 	xK_w		), spawn $ wifimenu)
	-- Show htop
	,((modm .|. shiftMask, 		xK_h		), spawn $ htop)
	-- Spawn your in-terminal music player 
--	,((modm, xF86XK_AudioPlay			), spawn $ myMusicTerm)
	-- Show alsamixer
	,((modm, xF86XK_AudioMute			), spawn $ alsamixer)
	-- Increase Volume
	,((0,   xF86XK_AudioRaiseVolume				), spawn "amixer sset Master 5%+")
	-- Lower Volume
	,((0,   xF86XK_AudioLowerVolume				), spawn "amixer sset Master 5%-")
	-- (Un)Mute Volume
	,((0,   xF86XK_AudioMute					), spawn "amixer -q sset Master toggle")
	-- Go to next track on Spotify 
	,((0, 	xF86XK_AudioNext					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")
	-- Go back to previous track on Spotify
	,((0, 	xF86XK_AudioPrev					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")
	-- Play/Pause on Spotify
	,((0, 	xF86XK_AudioPlay					), spawn "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")
	-- Rotate through the available layout algorithms
	,((modm,					xK_space    ), sendMessage NextLayout)
    --  Reset the layouts on the current workspace to default
    ,((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
    -- Resize viewed windows to the correct size
	,((modm,					xK_n        ), refresh)
	-- Move focus to the next window
	,((modm,					xK_Tab      ), windows W.focusDown)
	-- Move focus to the next window
	,((modm,					xK_j        ), windows W.focusDown)
	-- Move focus to the previous window
	,((modm,					xK_k        ), windows W.focusUp  )
	-- Move focus to the master window
	,((modm,					xK_m        ), windows W.focusMaster  )
	-- Swap the focused window and the master window
	,((modm .|. shiftMask, 		xK_m        ), windows W.swapMaster)
	-- Swap the focused window with the next window
	,((modm .|. shiftMask, 		xK_j        ), windows W.swapDown  )
	-- Swap the focused window with the previous window
	,((modm .|. shiftMask, 		xK_k        ), windows W.swapUp    )
	-- Shrink the master area
	,((modm,					xK_h        ), sendMessage Shrink)
	-- Expand the master area
	,((modm,					xK_l        ), sendMessage Expand)
	-- Push window back into tiling
	,((modm,					xK_t        ), withFocused $ windows . W.sink)
	-- Increment the number of windows in the master area
	,((modm,					xK_comma    ), sendMessage (IncMasterN (1)))
	-- Deincrement the number of windows in the master area
	,((modm, 					xK_period   ), sendMessage (IncMasterN (-1)))
--	,((modm,					#			), (moveTo Prev NonEmptyWS))
--	,((modm,					#			), (moveTo Next NonEmptyWS))
--	,((0,						2			), (\w -> focus w >> windows W.swapMaster))
--	,((0,						3			), (\w -> focus w >> FlexibleResize.mouseResizeWindow w))
    -- Quit xmonad
    , ((modm .|. shiftMask, xK_q     ), io (exitWith ExitSuccess))
    -- Restart xmonad
    , ((modm              , xK_q     ), spawn "xmonad --recompile; xmonad --restart")
    ]

    -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3

    ++
    [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
        | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
        , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]

    -- mod-[1..9], Switch to workspace N
    -- mod-shift-[1..9], Move client to workspace N
    -- NOTE: if you prefer the numpad, use "numPadKeys" instead.

    ++
	[((m .|. modm, k), windows $ f i)
		| (i, k) <- zip myWorkspaces numKeys
		, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
	]

---------------------------------------------------------------------------------------------------------------------------------
-- GLITCHES FOR DUMMIES
---------------------------------------------------------------------------------------------------------------------------------
-- Little hack here. Had to do this because of this:
-- http://xmonad.haskell.narkive.com/xPxUcjG9/window-s-overlaps-status-bar-after-xmonad-is-restarted
--
-- I tried all fixes around but nothing worked for me, except toggling the avoid struts externally, twice (turn off and turn on).
-- So I put this command between my startup commands, accordingly to the config:
--
-- bash -c 'sleep 1; xdotool key shift+ctrl+t && xdotool key shift+ctrl+t' &
---------------------------------------------------------------------------------------------------------------------------------

	-- Toggle the status bar gap
	-- Use this binding with avoidStruts from Hooks.ManageDocks.
	-- See also the statusBar function from Hooks.DynamicLog.
   
	++
	[((shiftMask .|. controlMask, 	xK_t 		), sendMessage ToggleStruts)]

---------------------------------------------------------------------------------------------------------------------------------
-- MOUSE BINDINGS
---------------------------------------------------------------------------------------------------------------------------------
-- Default actions bound to mouse events

myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
 
    -- mod-button1, Set the window to floating mode and move by dragging
    [ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
                                       >> windows W.shiftMaster))
 
    -- mod-button2, Raise the window to the top of the stack
    , ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
 
    -- mod-button3, Set the window to floating mode and resize by dragging
    , ((modm, button3), (\w -> focus w >> mouseResizeWindow w
                                       >> windows W.shiftMaster))
 
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    ]

---------------------------------------------------------------------------------------------------------------------------------
-- DZEN RULES FOR WORKSPACE NAME/COLOUR-SET, LAYOUT NAME & ACTIVE WINDOW TITLE
---------------------------------------------------------------------------------------------------------------------------------
-- Status bars and logging

-- Perform an arbitrary action on each internal state change or X event.
-- See the 'XMonad.Hooks.DynamicLog' extension for examples.

-- * NOTE: EwmhDesktops users should use the 'ewmh' function from
-- XMonad.Hooks.EwmhDesktops to modify their defaultConfig as a whole.
-- It will add EWMH logHook actions to your custom log hook by
-- combining it with ewmhDesktopsLogHook.

myLogHook h = dynamicLogWithPP ( defaultPP
	{
		  ppCurrent					= dzenColor color2 background .	pad
		, ppVisible					= dzenColor color6 background . pad
		, ppHidden					= dzenColor color12 background . pad
		, ppHiddenNoWindows			= dzenColor color8 background .	pad
		, ppWsSep					= ""
		, ppSep						= "    "
		, ppLayout					= wrap "^ca(1,xdotool key alt+space)" "^ca()" . dzenColor color1 background . 
			(\x -> case x of
				"F"					-> "^i("++myBitmapsDir++"layout_full.xbm) F"
				"T"					-> "^i("++myBitmapsDir++"layout_tall.xbm) T"
				"Ts"				-> "^i("++myBitmapsDir++"layout_tall.xbm) Ts"
				"mT"				-> "^i("++myBitmapsDir++"layout_mirror_tall.xbm) mT"
				"mTs"				-> "^i("++myBitmapsDir++"layout_mirror_tall.xbm) mTs"
				"G"					-> "^i("++myBitmapsDir++"grid.xbm) G"
				"Gs"				-> "^i("++myBitmapsDir++"grid.xbm) Gs"
				"Gm"				-> "^i("++myBitmapsDir++"grid.xbm) Gm"
				"M"					-> "^i("++myBitmapsDir++"mosa.xbm) M"
				"wM"				-> "^i("++myBitmapsDir++"mosa.xbm) wM"
				"O"					-> "^i("++myBitmapsDir++"onebig.xbm) O"
				"S"					-> "^i("++myBitmapsDir++"spiral.xbm) S"
			) 
		, ppOrder					= \(ws:l:t:_) -> [ws,l, t]
		, ppOutput					= hPutStrLn h
	} )

myBottomBar	= "conky -d -c '"++myHomeFolder++"/.xmonad/scripts/conkybot' | dzen2 -e '' -x '0' -y '1056' -h '24' -w '1980' -ta 'l' -fg '"++foreground++"' -bg '"++background++"' -fn '"++myFont++"'"
myTopLeft	= "dzen2 -e '' -x '0' -y '0' -h '24' -w '1280' -ta 'l' -fg '"++foreground++"' -bg '"++background++"' -fn '"++myFont++"'"
myTopRight	= "conky -d -c '"++myHomeFolder++"/.xmonad/scripts/conkytop' | dzen2 -e '' -x '1280' -y '0' -h '24' -w '700' -ta 'r' -fg '"++foreground++"' -bg '"++background++"' -fn '"++myFont++"'"

------------------------------------------------------------------------
-- MAIN
------------------------------------------------------------------------
-- Now run xmonad with all the defaults we set up.
--
-- Run xmonad with the settings you specify. No need to modify this.
--
-- A structure containing your configuration settings, overriding
-- fields in the default config. Any you don't override, will
-- use the defaults defined in xmonad/XMonad/Config.hs
--
-- No need to modify this.
--

main = do
	dzenTopLeftBar 		<- spawnPipe myTopLeft
	dzenTopRightBar 	<- spawnPipe myTopRight
	dzenBottomBar		<- spawnPipe myBottomBar

	xmonad $ fullscreenSupport defaultConfig
		{ terminal				= myTerminal
		, borderWidth			= 1
		, normalBorderColor 	= background
		, focusedBorderColor  	= color8
		, modMask				= myModMask
		, layoutHook			= smartBorders $ myLayout
		, workspaces			= myWorkspaces
		, manageHook			= myManageHook
		, handleEventHook		= docksEventHook
		, startupHook			= setWMName "LG3D"
		, logHook				= myLogHook dzenTopLeftBar
		, keys					= myKeys
        , mouseBindings			= myMouseBindings
		}

Offline

Board footer

Powered by FluxBB