xmonad switching screens + xsetwacom

Greetings How I can execute Code: xsetwacom set stylus Screen_No $No when I'm switching screen with hotkeys: Code: -- -- 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 .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] For example I need to spawn "xsetwacom set stylus Screen_No 0" when I'm switching to screen 1 by mod-q How I can do this? -- Пнд Окт 27 02:03:08 KRAT 2008 Sun Oct 26 19:03:08 UTC 2008 ---------------------------------- Visit my home page http://akhilman.blogspot.com/ ---------------------------------- jabber: akhil@jabber.ru ---------------------------------- Пытаться сделать мир на 1/6.7e9 лучше Ахметгалеев Ильдар aka AkhIL ---------------------------------- Linux artstation 2.6.25-gentoo-r7 #1 SMP Mon Aug 11 08:02:41 KRAST 2008 i686 AMD Athlon(tm) XP 2500+ AuthenticAMD GNU/Linux up 7 days, 6:43, 1 user, load average: 0.24, 0.23, 0.18

On Sun, Oct 26, 2008 at 3:05 PM, IL'dar AKHmetgaleev
Greetings
How I can execute Code: xsetwacom set stylus Screen_No $No when I'm switching screen with hotkeys: Code: -- -- 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 .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
For example I need to spawn "xsetwacom set stylus Screen_No 0" when I'm switching to screen 1 by mod-q
How I can do this?
A rough stab at a solution: , ((modMask, xK_q), spawn "xsetwacom set stylus Screen_No 0"
(screenWorkspace sc >>= flip whenJust (windows ○ f)) 1)))
This untested fragment obviously isn't exactly what you want, but it shows a few pieces of the puzzle: the use of 'spawn' to run your shell command, the use of >> inside a X () action to do multiple things on the same key press, and it hints at how to deconstruct the list comprehension and do the workspace-switching manually*. However, I leave it to another to tell you how to run spawn only if switching to workspace 1 instead of running it on every workspace switch. * I incidentally have long thought that that list comprehension was cleverness for the sake of being clever, and makes it difficult for people to modify or even understand it. -- gwern

На Sun, 26 Oct 2008 15:56:33 -0400
"Gwern Branwen"
Greetings
How I can execute Code: xsetwacom set stylus Screen_No $No when I'm switching screen with hotkeys: Code: -- -- 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 .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
For example I need to spawn "xsetwacom set stylus Screen_No 0" when I'm switching to screen 1 by mod-q
How I can do this?
A rough stab at a solution:
, ((modMask, xK_q), spawn "xsetwacom set stylus Screen_No 0"
(screenWorkspace sc >>= flip whenJust (windows ○ f)) 1)))
ok. I'm little closer [((m .|. modMask, key), spawn "xsetwacom set stylus Screen_No " ++ sc >> screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q,xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] of course it doesn't work Couldn't match expected type `ScreenId' against inferred type `[()]' Now how I can subtract one from sc and convert it to string? Пнд Окт 27 07:50:03 KRAT 2008 Mon Oct 27 00:50:03 UTC 2008 ---------------------------------- Visit my home page http://akhilman.blogspot.com/ ---------------------------------- jabber: akhil@jabber.ru ---------------------------------- Пытаться сделать мир на 1/6.7e9 лучше Ахметгалеев Ильдар aka AkhIL ---------------------------------- Linux artstation 2.6.25-gentoo-r7 #1 SMP Mon Aug 11 08:02:41 KRAST 2008 i686 AMD Athlon(tm) XP 2500+ AuthenticAMD GNU/Linux up 7 days, 12:30, 1 user, load average: 0.03, 0.11, 0.05

На Sun, 26 Oct 2008 15:56:33 -0400
"Gwern Branwen"
Greetings
How I can execute Code: xsetwacom set stylus Screen_No $No when I'm switching screen with hotkeys: Code: -- -- 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 .|. modMask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
For example I need to spawn "xsetwacom set stylus Screen_No 0" when I'm switching to screen 1 by mod-q
How I can do this?
A rough stab at a solution:
, ((modMask, xK_q), spawn "xsetwacom set stylus Screen_No 0"
(screenWorkspace sc >>= flip whenJust (windows ○ f)) 1)))
I have got mostly what I want. [((m .|. modMask, key), spawn ("mysetwacom.sh -" ++ show sc)
screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_q, xK_w, xK_e] [0..] , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
show sc returns "S 0", "S 1", "S n"... I don't know how to leave number alone. But it's just enough to me. Now I can work this data inside bash script. -- Пнд Окт 27 08:27:09 KRAT 2008 Mon Oct 27 01:27:09 UTC 2008 ---------------------------------- Visit my home page http://akhilman.blogspot.com/ ---------------------------------- jabber: akhil@jabber.ru ---------------------------------- Пытаться сделать мир на 1/6.7e9 лучше Ахметгалеев Ильдар aka AkhIL ---------------------------------- Linux artstation 2.6.25-gentoo-r7 #1 SMP Mon Aug 11 08:02:41 KRAST 2008 i686 AMD Athlon(tm) XP 2500+ AuthenticAMD GNU/Linux up 7 days, 13:07, 1 user, load average: 0.20, 0.17, 0.13
participants (2)
-
Gwern Branwen
-
IL'dar AKHmetgaleev