Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1691410
  • 博文数量: 410
  • 博客积分: 9563
  • 博客等级: 中将
  • 技术积分: 4517
  • 用 户 组: 普通用户
  • 注册时间: 2010-07-03 19:59
个人简介

文章分类

全部博文(410)

文章存档

2017年(6)

2016年(1)

2015年(3)

2014年(4)

2013年(32)

2012年(45)

2011年(179)

2010年(140)

分类: LINUX

2010-07-26 15:11:55

我的Firefox下载页面默认会平铺,每次都会让页面变化,很不爽,把我的xmonad.hs调整一下
import XMonad
import XMonad.Config.Gnome
import XMonad.Hooks.SetWMName

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

main = do
xmonad $ gnomeConfig
    {
    modMask = mod4Mask
    -- set the mod key to the windows key
    , XMonad.focusFollowsMouse = False
    --不设置鼠标跟随
, manageHook = myManageHook <+> manageHook gnomeConfig    
, startupHook = setWMName "LG3D"
    }

$xmonad --recompile
mod+q
现在下载页面就是浮动窗口了
附件:(用xprop | grep -i wm_class 命令取窗口属性)
[]

3.16 I need to find the class title or some other X property of my program

If you are using something like XMonad.Actions.WindowGo, or a hook, or some other feature like that where XMonad needs to know detailed information about a window, you can generally find what you need by splitting your screen between the window and a terminal; in the terminal, run xprop | grep CLASS or the like, and then click on the window. xprop will then print out quite a bit of useful information about the window.

  • resource (also known as appName) is the first element in WM_CLASS(STRING)
  • className is the second element in WM_CLASS(STRING)
  • title is WM_NAME(STRING)

For example, in WM_CLASS(STRING) = "emacs", "Emacs" -- "emacs" is resource (appName), "Emacs" is className.

(Applications may change the title after window creation, before xprop sees it. If possible, use resource or class in such cases.) stringProperty "WM_WINDOW_ROLE" can also be useful.

Sample output might look like:

_MOTIF_DRAG_RECEIVER_INFO(_MOTIF_DRAG_RECEIVER_INFO) = 0x6c, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0
XdndAware(ATOM) = BITMAP
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
Initial state is Normal State.
window id # of group leader: 0xf600001
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 257949716
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0xf600013
WM_CLIENT_LEADER(WINDOW): window id # 0xf600001
_NET_WM_PID(CARDINAL) = 476661
WM_LOCALE_NAME(STRING) = "en_US.utf8"
WM_CLIENT_MACHINE(STRING) = "localhost"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
program specified minimum size: 32 by 34
program specified resize increment: 8 by 17
program specified base size: 16 by 0
window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "emacs", "Emacs"
WM_ICON_NAME(STRING) = "emacs@craft"
_NET_WM_ICON_NAME(UTF8_STRING) = 0x45, 0x4d, 0x41, 0x43, 0x53
WM_NAME(STRING) = "EMACS"
_NET_WM_NAME(UTF8_STRING) = 0x45, 0x4d, 0x41, 0x43, 0x53

Note: the last several lines contain useful information like the CLASS and hinting information.

[]

3.16.1 What about other properties, such as WM_WINDOW_ROLE?

Use stringProperty to extract string information, for example:

stringProperty "WM_WINDOW_ROLE" =? "presentationWidget" --> doFloat

For non-string properties, try .

Consult the documentation for more information.


调整vmplay虚拟机自动到office工作区
import XMonad
import XMonad.Config.Gnome
import XMonad.ManageHook
import qualified XMonad.StackSet as W
import XMonad.Hooks.SetWMName

myWorkspaces = ["1:main","2:web","3:gvim","4:media","5:graph","6:browse","7:dev","8:office","9:other"]

myManageHook = composeAll [ (className =? "Firefox" <&&> resource=? "Download") --> doFloat
        , (className =? "Firefox" <&&> resource =? "DTA") --> doFloat
        , (className =? "Vmplayer" <&&> title=? "new of Windows XP office - VMware Player") --> doF (W.shift "8:office")
        ]

main = do
xmonad $ gnomeConfig
    {
        modMask = mod4Mask
        -- set the mod key to the windows key
        , XMonad.focusFollowsMouse = False
        --不设置鼠标跟随
        , workspaces = myWorkspaces
        , manageHook = myManageHook <+> manageHook gnomeConfig    
        , startupHook = setWMName "LG3D"
    }


阅读(1740) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~