You are not logged in.
Pages: 1
Hi,
When i start ncmpcpp in xmonad i want to send it to workspace "5:Mp3" and view it. How to do that?
This is my xmonad.sh:
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
import qualified XMonad.StackSet as W
import XMonad.Hooks.ManageHelpers
import XMonad.Actions.NoBorders
import XMonad.Layout.NoBorders
import XMonad.Actions.FloatKeys
import XMonad.Actions.CycleWindows
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.Named
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.MultiToggle
import XMonad.Layout.MultiToggle.Instances
import XMonad.Layout.ResizableTile
import XMonad.Layout.MouseResizableTile
import XMonad.Layout.Simplest
import XMonad.Layout.SimplestFloat
import XMonad.Layout.Mosaic
import XMonad.Layout.MosaicAlt
import XMonad.Layout.Spacing
import XMonad.Layout.Grid
import XMonad.Layout.Accordion
import Data.Ratio ((%))
import XMonad.Layout.MosaicAlt
import qualified Data.Map as M
import qualified System.IO.UTF8
import XMonad.Layout.Spacing
import XMonad.Layout.Spiral
import XMonad.Layout.Tabbed
import XMonad.Layout.TwoPane
import XMonad.Layout.PerWorkspace
import XMonad.Layout.WorkspaceDir
import XMonad.Layout.Magnifier
import XMonad.Layout.Reflect
import XMonad.Layout.Named
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Layout.WindowNavigation
import XMonad.Layout.LayoutCombinators hiding ((|||))
import Control.Monad (liftM2)
import Graphics.X11.ExtraTypes.XF86
import Data.List
import XMonad.Actions.WindowGo
myManageHook = composeAll
[ className =? "Gimp" --> doFloat
, className =? "Pidgin" --> doFloat
, className =? "MPlayer" --> doFloat
, className =? "Skype" --> doFloat
, className =? "Arandr" --> doFloat
, className =? "LibreOffice" --> doFloat
, className =? "Lxappearance" --> doFloat
, className =? "Xchat" --> doFloat
, className =? "Oblogout" --> doFloat
, className =? "Firefox" --> viewShift "2:Web"
, className =? "Xmessage" --> doFloat
, className =? "File Operation Progress" --> doFloat
, className =? "Chromium" --> viewShift "4:Web"
, className =? "Opera" --> viewShift "4:Web"
, className =? "Skype" --> viewShift "3:Skype"
, className =? "Thunar" --> viewShift "2:Home"
, className =? "Gimp" --> viewShift "6:Gimp"
, className =? "URxvt" --> viewShift "1:Term"
, className =? "MPlayer" --> viewShift "8:Mov"
, className =? "Trayer" --> doIgnore
, isFullscreen --> doFullFloat
, isDialog --> doFloat
]
where viewShift = doF . liftM2 (.) W.greedyView W.shift
myLayoutHook = avoidStruts $ tiled ||| Mirror tiled ||| Full ||| Simplest ||| simplestFloat
where
-- default tiling algorithm partitions the screen into two panes
tiled = spacing 10 $ Tall nmaster delta ratio
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 2/3
-- Percent of screen to increment by when resizing panes
delta = 5/100
myWorkspaces = ["1:Term", "2:Home", "3:Skype", "4:Web", "5:Mp3", "6:Gimp", "7:Prog", "8:Mov", "9:Main"]
startup :: X ()
startup = do
spawn "xfce4-power-manager"
spawn "trayer --transparent true --alpha 255"
--spawn "volumeicon"
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig
{ borderWidth = 2
, normalBorderColor = "#000000"
, focusedBorderColor = "#1793D1"
, workspaces = myWorkspaces
, terminal = "urxvt"
}
{ manageHook = manageDocks <+> myManageHook -- make sure to include myManageHook definition from above
<+> manageHook defaultConfig
, layoutHook = myLayoutHook
, startupHook = startup
, logHook = dynamicLogWithPP $ xmobarPP
{ ppOutput = hPutStrLn xmproc
, ppTitle = xmobarColor "#ffffff" "" . shorten 35
, ppCurrent = xmobarColor "#ffffff" "" . wrap "" ""
, ppUrgent = xmobarColor "#ffffff" "" . wrap "<" ">"
, ppLayout = xmobarColor "#1793D1" ""
, ppSep = xmobarColor "#ffffff" "" " : "
}
, modMask = mod4Mask -- Rebind Mod to the Windows key
} `additionalKeys`
[ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s")
, ((0, xK_Print), spawn "scrot")
, ((0, 0x1008ff11 ), spawn "amixer -q set Master 2dB-" ) -- XF86AudioLowerVolume: Lower audio volume
, ((0, 0x1008ff12 ), spawn "amixer -q set Master toggle" ) -- XF86AudioMute: Mute audio
, ((0, 0x1008ff13 ), spawn "amixer -q set Master 2dB+" ) -- XF86AudioRaiseVolume: Raise audio volume
, ((mod4Mask , xK_t ), spawn "urxvt -e rtorrent")
, ((mod4Mask , xK_f ), spawn "firefox")
, ((mod4Mask , xK_F7 ), spawn "feh --auto-zoom --full-screen --hide-pointer --randomize --slideshow-delay 10 --title \"feh() | %n\" /home/dejan/MyGirl/*.jpg /home/dejan/MyGirl/*.png")
, ((mod4Mask , xK_s ), spawn "skype")
, ((mod4Mask , xK_i ), spawn "pidgin")
, ((mod4Mask , xK_d ), spawn "thunar")
, ((mod4Mask , xK_a ), spawn "chromium")
, ((mod4Mask , xK_o ), spawn "opera")
, ((mod4Mask , xK_l ), spawn "dmenu_run -b")
, ((mod4Mask , xK_w ), spawn "urxvt -e wicd-curses")
, ((mod4Mask , xK_m ), spawn "urxvt -e ncmpcpp")
, ((mod4Mask , xK_v ), spawn "urxvt -e alsamixer")
, ((mod4Mask , xK_x ), spawn "urxvt -e nano /home/dejan/.xmonad/xmonad.hs")
, ((mod4Mask , xK_z ), withFocused toggleBorder)
, ((mod4Mask , xK_g ), spawn "gimp")
, ((mod4Mask , xK_F9 ), spawn "sudo reboot")
, ((mod4Mask , xK_F10 ), spawn "sudo shutdown -h now")
]
Thanks.
And... here... we... go!
Offline
Start it a named terminal - depending, and you'll be able to make a rule for it just like everything else. What terminal are you using?
Offline
You've already got the pieces there, just put them together
, className =? "Ncmpcpp" --> doFloat
, className =? "Ncmpcpp" --> viewShift "5:Mp3"
You'll have to check the classname of Ncmpcpp as I don't have it. If it's a gui app then use `xprop | grep CLASS` then click on it's window. If it is a terminal app, you'll have to launch it with the appropriate parameters to rename the terminal and replace "Ncmpcpp" with whatever name you chose to give that terminal.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I'm new in xmonad and i still learn how to use this wm.I use urxvt as termnal and ncmpcpp is terminal app. Can you explain to me how to start ncmpcpp with named terminal and how to rename terminal?
Thanks.
And... here... we... go!
Offline
grobar, I realized after the fact I'm not even sure there is an easy way to set the classname of a terminal window. However it is *very* easy to set the title or application name. Xmonad can use either of these in place of the classname:
, title =? "my ncmpcpp window" --> doFloat
or you could make your own property (not yet tested in xmonad):
, stringProperty "MY_CUSTOM_PROPERTY" =? "Ncmpcpp" --> doFloat
These can then be set when the program in launched with urxvt's -name option for the title, or after the terminal is opened by using xprop's "-set MY_CUSTOM_PROPERTY "Ncmpcpp".
See the Xmonad page for more information on the manageHook matching abilities.
Last edited by Trilby (2012-04-08 01:36:08)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
see the name flag for urxvt, it is a nice way to identify which window contains what.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Pages: 1