Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function playSound(soundfile) {
- var filepath = "/usr/share/sounds/" + soundfile;
- //todo actually play the sound
- print ("Play: " + filepath);
- }
- function soundOnMinimize(client) {
- playSound("Oxygen-Window-Minimize.ogg");
- }
- function soundOnUnminimize(client) {
- playSound("Oxygen-Window-Maximize.ogg");
- }
- function soundOnMaximize(client, h, v) {
- if (h && v) {
- // maximized
- playSound("Oxygen-Window-Maximize.ogg");
- } else {
- // no longer maximized
- playSound("Oxygen-Window-Minimize.ogg");
- }
- }
- function soundOnClosed(client) {
- playSound("Oxygen-Window-Close.ogg");
- }
- function soundOnMoveStart() {
- playSound("Oxygen-Window-Move.ogg");
- }
- function soundOnMoveStop() {
- playSound("Oxygen-Window-Move-Stop.ogg");
- }
- function handleNewClient(client) {
- client.clientStartUserMovedResized.connect(soundOnMoveStart);
- client.clientFinishUserMovedResized.connect(soundOnMoveStop);
- client.clientMinimized.connect(soundOnMinimize);
- client.clientUnminimized.connect(soundOnUnminimize);
- // client.clientMaximizedStateChanged.connect(soundOnMaximize);
- }
- // workaround for client.clientMaximizedStateChagned - couldn't get it to work properly since I don't know how to access overloaded signals in JS
- workspace.clientMaximizeSet.connect(soundOnMaximize);
- workspace.clientAdded.connect(handleNewClient);
- // the window does not emit closed() but the workspace does
- workspace.clientRemoved.connect(soundOnClosed);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement