mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Adding system sounds to XMonad config.
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
- [[#layouts][Layouts]]
|
- [[#layouts][Layouts]]
|
||||||
- [[#workspaces][Workspaces]]
|
- [[#workspaces][Workspaces]]
|
||||||
- [[#managehook][Managehook]]
|
- [[#managehook][Managehook]]
|
||||||
|
- [[#system-sounds][System Sounds]]
|
||||||
- [[#keybindings][Keybindings]]
|
- [[#keybindings][Keybindings]]
|
||||||
- [[#main][Main]]
|
- [[#main][Main]]
|
||||||
|
|
||||||
@@ -152,6 +153,9 @@ myNormColor = colorBack -- This variable is imported from Colors.THEME
|
|||||||
myFocusColor :: String -- Border color of focused windows
|
myFocusColor :: String -- Border color of focused windows
|
||||||
myFocusColor = color15 -- This variable is imported from Colors.THEME
|
myFocusColor = color15 -- This variable is imported from Colors.THEME
|
||||||
|
|
||||||
|
mySoundPlayer :: String
|
||||||
|
mySoundPlayer = "ffplay -nodisp -autoexit " -- The program that will play system sounds
|
||||||
|
|
||||||
windowCount :: X (Maybe String)
|
windowCount :: X (Maybe String)
|
||||||
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@@ -162,6 +166,7 @@ These are commands we want XMonad to execute on startup, such as running a compo
|
|||||||
#+BEGIN_SRC haskell
|
#+BEGIN_SRC haskell
|
||||||
myStartupHook :: X ()
|
myStartupHook :: X ()
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
|
spawnOnce (mySoundPlayer ++ startupSound)
|
||||||
spawn "killall conky" -- kill current conky on each restart
|
spawn "killall conky" -- kill current conky on each restart
|
||||||
spawn "killall trayer" -- kill current trayer on each restart
|
spawn "killall trayer" -- kill current trayer on each restart
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
@@ -171,7 +176,7 @@ myStartupHook = do
|
|||||||
spawnOnce "picom"
|
spawnOnce "picom"
|
||||||
spawnOnce "nm-applet"
|
spawnOnce "nm-applet"
|
||||||
spawnOnce "volumeicon"
|
spawnOnce "volumeicon"
|
||||||
spawnOnce "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
|
spawn "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
We killed any running conky and trayer processes earlier in the autostart, so now we sleep for 2 seconds and then restart conky and trayer.
|
We killed any running conky and trayer processes earlier in the autostart, so now we sleep for 2 seconds and then restart conky and trayer.
|
||||||
@@ -442,6 +447,26 @@ myManageHook = composeAll
|
|||||||
] <+> namedScratchpadManageHook myScratchPads
|
] <+> namedScratchpadManageHook myScratchPads
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* System Sounds
|
||||||
|
Available sounds that are part of the default =dtos-sounds= package include:
|
||||||
|
+ menu-01.mp3
|
||||||
|
+ menu-02.mp3
|
||||||
|
+ menu-03.mp3
|
||||||
|
+ shutdown-01.mp3
|
||||||
|
+ shutdown-02.mp3
|
||||||
|
+ shutdown-03.mp3
|
||||||
|
+ startup-01.mp3
|
||||||
|
+ startup-02.mp3
|
||||||
|
+ startup-03.mp3
|
||||||
|
|
||||||
|
#+begin_src haskell
|
||||||
|
soundDir = "/opt/dtos-sounds/" -- The directory that has the sound files
|
||||||
|
|
||||||
|
startupSound = soundDir ++ "startup-01.mp3"
|
||||||
|
shutdownSound = soundDir ++ "shutdown-01.mp3"
|
||||||
|
dmenuSound = soundDir ++ "menu-01.mp3"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
* Keybindings
|
* Keybindings
|
||||||
I am using the Xmonad.Util.EZConfig module which allows keybindings to be written in simpler, emacs-like format. The Super/Windows key is 'M' (the modkey). The ALT key is 'M1'. SHIFT is 'S' and CTR is 'C'.
|
I am using the Xmonad.Util.EZConfig module which allows keybindings to be written in simpler, emacs-like format. The Super/Windows key is 'M' (the modkey). The ALT key is 'M1'. SHIFT is 'S' and CTR is 'C'.
|
||||||
|
|
||||||
@@ -477,14 +502,16 @@ myKeys =
|
|||||||
-- KB_GROUP Xmonad
|
-- KB_GROUP Xmonad
|
||||||
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
|
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
|
||||||
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
||||||
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
, ("M-S-q", sequence_ [spawn (mySoundPlayer ++ shutdownSound)
|
||||||
|
, io exitSuccess]) -- Quits xmonad
|
||||||
|
|
||||||
-- KB_GROUP Get Help
|
-- KB_GROUP Get Help
|
||||||
, ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") -- Get list of keybindings
|
, ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") -- Get list of keybindings
|
||||||
, ("M-/", spawn "dtos-help") -- DTOS help/tutorial videos
|
, ("M-/", spawn "dtos-help") -- DTOS help/tutorial videos
|
||||||
|
|
||||||
-- KB_GROUP Run Prompt
|
-- KB_GROUP Run Prompt
|
||||||
, ("M-S-<Return>", spawn "dm-run") -- Dmenu
|
, ("M-S-<Return>", sequence_ [spawn (mySoundPlayer ++ dmenuSound)
|
||||||
|
, spawn "dm-run"]) -- Dmenu
|
||||||
|
|
||||||
-- KB_GROUP Other Dmenu Prompts
|
-- KB_GROUP Other Dmenu Prompts
|
||||||
-- In Xmonad and many tiling window managers, M-p is the default keybinding to
|
-- In Xmonad and many tiling window managers, M-p is the default keybinding to
|
||||||
|
|||||||
@@ -108,11 +108,15 @@ myNormColor = colorBack -- This variable is imported from Colors.THEME
|
|||||||
myFocusColor :: String -- Border color of focused windows
|
myFocusColor :: String -- Border color of focused windows
|
||||||
myFocusColor = color15 -- This variable is imported from Colors.THEME
|
myFocusColor = color15 -- This variable is imported from Colors.THEME
|
||||||
|
|
||||||
|
mySoundPlayer :: String
|
||||||
|
mySoundPlayer = "ffplay -nodisp -autoexit " -- The program that will play system sounds
|
||||||
|
|
||||||
windowCount :: X (Maybe String)
|
windowCount :: X (Maybe String)
|
||||||
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
||||||
|
|
||||||
myStartupHook :: X ()
|
myStartupHook :: X ()
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
|
spawnOnce (mySoundPlayer ++ startupSound)
|
||||||
spawn "killall conky" -- kill current conky on each restart
|
spawn "killall conky" -- kill current conky on each restart
|
||||||
spawn "killall trayer" -- kill current trayer on each restart
|
spawn "killall trayer" -- kill current trayer on each restart
|
||||||
|
|
||||||
@@ -120,7 +124,7 @@ myStartupHook = do
|
|||||||
spawnOnce "picom"
|
spawnOnce "picom"
|
||||||
spawnOnce "nm-applet"
|
spawnOnce "nm-applet"
|
||||||
spawnOnce "volumeicon"
|
spawnOnce "volumeicon"
|
||||||
spawnOnce "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
|
spawn "/usr/bin/emacs --daemon" -- emacs daemon for the emacsclient
|
||||||
|
|
||||||
spawn ("sleep 2 && conky -c $HOME/.config/conky/xmonad/" ++ colorScheme ++ "-01.conkyrc")
|
spawn ("sleep 2 && conky -c $HOME/.config/conky/xmonad/" ++ colorScheme ++ "-01.conkyrc")
|
||||||
spawn ("sleep 2 && trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 " ++ colorTrayer ++ " --height 22")
|
spawn ("sleep 2 && trayer --edge top --align right --widthtype request --padding 6 --SetDockType true --SetPartialStrut true --expand true --monitor 1 --transparent true --alpha 0 " ++ colorTrayer ++ " --height 22")
|
||||||
@@ -355,20 +359,28 @@ myManageHook = composeAll
|
|||||||
, isFullscreen --> doFullFloat
|
, isFullscreen --> doFullFloat
|
||||||
] <+> namedScratchpadManageHook myScratchPads
|
] <+> namedScratchpadManageHook myScratchPads
|
||||||
|
|
||||||
|
soundDir = "/opt/dtos-sounds/" -- The directory that has the sound files
|
||||||
|
|
||||||
|
startupSound = soundDir ++ "startup-01.mp3"
|
||||||
|
shutdownSound = soundDir ++ "shutdown-01.mp3"
|
||||||
|
dmenuSound = soundDir ++ "menu-01.mp3"
|
||||||
|
|
||||||
-- START_KEYS
|
-- START_KEYS
|
||||||
myKeys :: [(String, X ())]
|
myKeys :: [(String, X ())]
|
||||||
myKeys =
|
myKeys =
|
||||||
-- KB_GROUP Xmonad
|
-- KB_GROUP Xmonad
|
||||||
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
|
[ ("M-C-r", spawn "xmonad --recompile") -- Recompiles xmonad
|
||||||
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
, ("M-S-r", spawn "xmonad --restart") -- Restarts xmonad
|
||||||
, ("M-S-q", io exitSuccess) -- Quits xmonad
|
, ("M-S-q", sequence_ [spawn (mySoundPlayer ++ shutdownSound)
|
||||||
|
, io exitSuccess]) -- Quits xmonad
|
||||||
|
|
||||||
-- KB_GROUP Get Help
|
-- KB_GROUP Get Help
|
||||||
, ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") -- Get list of keybindings
|
, ("M-S-/", spawn "~/.xmonad/xmonad_keys.sh") -- Get list of keybindings
|
||||||
, ("M-/", spawn "dtos-help") -- DTOS help/tutorial videos
|
, ("M-/", spawn "dtos-help") -- DTOS help/tutorial videos
|
||||||
|
|
||||||
-- KB_GROUP Run Prompt
|
-- KB_GROUP Run Prompt
|
||||||
, ("M-S-<Return>", spawn "dm-run") -- Dmenu
|
, ("M-S-<Return>", sequence_ [spawn (mySoundPlayer ++ dmenuSound)
|
||||||
|
, spawn "dm-run"]) -- Dmenu
|
||||||
|
|
||||||
-- KB_GROUP Other Dmenu Prompts
|
-- KB_GROUP Other Dmenu Prompts
|
||||||
-- In Xmonad and many tiling window managers, M-p is the default keybinding to
|
-- In Xmonad and many tiling window managers, M-p is the default keybinding to
|
||||||
|
|||||||
Reference in New Issue
Block a user