Advertisement
Guest User

Untitled

a guest
Nov 17th, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. function playSound(soundfile) {
  2. var filepath = "/usr/share/sounds/" + soundfile;
  3. //todo actually play the sound
  4. print ("Play: " + filepath);
  5. }
  6.  
  7.  
  8. function soundOnMinimize(client) {
  9. playSound("Oxygen-Window-Minimize.ogg");
  10. }
  11.  
  12. function soundOnUnminimize(client) {
  13. playSound("Oxygen-Window-Maximize.ogg");
  14. }
  15.  
  16. function soundOnMaximize(client, h, v) {
  17. if (h && v) {
  18. // maximized
  19. playSound("Oxygen-Window-Maximize.ogg");
  20. } else {
  21. // no longer maximized
  22. playSound("Oxygen-Window-Minimize.ogg");
  23. }
  24. }
  25.  
  26. function soundOnClosed(client) {
  27. playSound("Oxygen-Window-Close.ogg");
  28. }
  29.  
  30. function soundOnMoveStart() {
  31. playSound("Oxygen-Window-Move.ogg");
  32. }
  33.  
  34. function soundOnMoveStop() {
  35. playSound("Oxygen-Window-Move-Stop.ogg");
  36. }
  37.  
  38. function handleNewClient(client) {
  39. client.clientStartUserMovedResized.connect(soundOnMoveStart);
  40. client.clientFinishUserMovedResized.connect(soundOnMoveStop);
  41. client.clientMinimized.connect(soundOnMinimize);
  42. client.clientUnminimized.connect(soundOnUnminimize);
  43. // client.clientMaximizedStateChanged.connect(soundOnMaximize);
  44. }
  45.  
  46. // workaround for client.clientMaximizedStateChagned - couldn't get it to work properly since I don't know how to access overloaded signals in JS
  47. workspace.clientMaximizeSet.connect(soundOnMaximize);
  48. workspace.clientAdded.connect(handleNewClient);
  49.  
  50. // the window does not emit closed() but the workspace does
  51. workspace.clientRemoved.connect(soundOnClosed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement