From 02ad740c33bf4291616ac080e9705fcdfa621575 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 13:19:25 +0100 Subject: .config/qtile/config.py: Adding WIP for retrieving and killing compton on demand. Adding call to DIY backlight script call, instead of xbacklight. --- .config/qtile/config.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.config/qtile/config.py b/.config/qtile/config.py index 244b836..5bf23ee 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -6,7 +6,8 @@ import os import re import subprocess from libqtile.log_utils import logger - +# import psutil +# import getpass mod = "mod4" alt = "mod1" @@ -18,9 +19,9 @@ terminal = "termite" drun_launcher = "rofi -show drun" run_launcher = "rofi -show run" lock = home+"/bin/xorg_lock" -brightness_step = "5" -brightness_up = "xbacklight -inc "+brightness_step -brightness_down = "xbacklight -dec "+brightness_step +brightness_step = "2" +brightness_up = "backlight -i "+brightness_step +brightness_down = "backlight -i -"+brightness_step volume_up = home+"/bin/set_volume increase" volume_down = home+"/bin/set_volume decrease" volume_toggle = home+"/bin/set_volume toggle" @@ -482,3 +483,14 @@ def autostart_conky(): @hook.subscribe.startup_complete def autostart_compton(): subprocess.call(compton) +# get_user_processes('compton') + + +# def get_user_processes(process_name): +# for process in psutil.process_iter(attrs=['name', 'username']): +# if process.info['username'] == getpass.getuser() and \ +# process.info['name'] == process_name: +# logger.setLevel(logging.INFO) +# logger.info(process.pid) +# logger.info(process.info['name']) +# logger.setLevel(logging.WARNING) -- cgit v1.2.3-54-g00ecf From 3f6de062dfd39906b461b095afbba6ccdd3b0e5b Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 13:51:28 +0100 Subject: .config/qtile/config.py: Adding qutebrowser to web tag. Adding Carla and Cadence to audio tag. --- .config/qtile/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/qtile/config.py b/.config/qtile/config.py index d2283be..c8a535b 100644 --- a/.config/qtile/config.py +++ b/.config/qtile/config.py @@ -154,6 +154,7 @@ matchers = { Match(wm_class=[ re.compile('Chromium$'), re.compile('Firefox$'), + re.compile('.*qutebrowser$'), re.compile('TorLauncher'), re.compile('Tor Browser'), ]), @@ -197,6 +198,8 @@ matchers = { re.compile('Ardour'), re.compile('Audacity'), re.compile('Calfjackhost'), + re.compile('Carla'), + re.compile('Cadence'), re.compile('Ffado-mixer'), re.compile('Guitarix'), re.compile('Session Setup'), -- cgit v1.2.3-54-g00ecf From 3d4e8438d0b0ca637ae62b0bf9d870841c8cfda1 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 17:01:49 +0100 Subject: .config/SuperCollider/startup.scd: Introducing the concept of additional channels (to scsynth), above the hardware in and outputs (to be defined before starting the server). Conditionally adding functions.scd, holding custom functions. --- .config/SuperCollider/startup.scd | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.config/SuperCollider/startup.scd b/.config/SuperCollider/startup.scd index 4bf8669..1bc834d 100644 --- a/.config/SuperCollider/startup.scd +++ b/.config/SuperCollider/startup.scd @@ -87,9 +87,12 @@ if(PathName("/dev/fw1").isFile, { }; }); }); +~additionalChannels = Dictionary.with(*[\inputs -> Dictionary.with(*[]), \outputs -> Dictionary.with(*[])]); Server.local.options.numInputBusChannels = ~audioInterfaceOptions.at(\numInputs); Server.local.options.numOutputBusChannels = ~audioInterfaceOptions.at(\numOutputs); postln("Loaded settings for: "++~audioInterfaceOptions.at(\name)); +postln("Additional channels: "++~additionalChannels.at(\inputs).values++"/ "++~additionalChannels.at(\outputs).values); + //postln("Initializing and connecting MIDI devices."); //MIDIClient.init; //MIDIIn.connectAll; @@ -98,3 +101,7 @@ postln("Loaded settings for: "++~audioInterfaceOptions.at(\name)); if (File.exists(Platform.userConfigDir++"/synthdefs.scd"), { File.readAllString(Platform.userConfigDir++"/synthdefs.scd").interpret; }); + +if (File.exists(Platform.userConfigDir++"/functions.scd"), { + File.readAllString(Platform.userConfigDir++"/functions.scd").interpret; +}); -- cgit v1.2.3-54-g00ecf From f3ee15d598cbdabd9fc0b55b9f4fc99dd7af30e9 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 17:02:25 +0100 Subject: .config/SuperCollider/synthdefs.scd: Being more clear in the description. --- .config/SuperCollider/synthdefs.scd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.config/SuperCollider/synthdefs.scd b/.config/SuperCollider/synthdefs.scd index 4a75b4c..51d320d 100644 --- a/.config/SuperCollider/synthdefs.scd +++ b/.config/SuperCollider/synthdefs.scd @@ -1,6 +1,6 @@ postln("Adding custom SynthDefs"); -// route 8 Ins to Out +// route 8 Ins to 8 Outs SynthDef(\route8BussesToOut, { arg in=0, volume=#[0,0,0,0,0,0,0,0], @@ -25,7 +25,7 @@ SynthDef(\filter8Rumble, { ); }).add; -// Mix down SoundIns to one +// Mix down SoundIns to one Out SynthDef(\mix4BussesToOut, { arg in=#[0,1,2,3], volume=#[0,0,0,0], -- cgit v1.2.3-54-g00ecf From 73fca249f23bd236a00f1e9282709f456c23b9b8 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 17:04:01 +0100 Subject: .config/SuperCollider/functions.scd: Adding simple helper functions to connect/disconnect JACK clients by name:port_name. Adding function to add additional channels (above hardware in and outputs), which automatically increments Server.local.options.num{In,Out}putBuschannels. --- .config/SuperCollider/functions.scd | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .config/SuperCollider/functions.scd diff --git a/.config/SuperCollider/functions.scd b/.config/SuperCollider/functions.scd new file mode 100644 index 0000000..fecd1a0 --- /dev/null +++ b/.config/SuperCollider/functions.scd @@ -0,0 +1,58 @@ +postln('Loading custom functions.'); + +/* + * JACK specific helper functions + * + */ +// disconnect a port +~jackDisconnectPort = { + arg source, sourceChannel, destination, destinationChannel; + ("jack_disconnect "++source++":"++sourceChannel++" "++destination++":"++destinationChannel).unixCmd({ + arg exitCode; + if(exitCode != 0, { + postln("Disconnecting "++source++":"++sourceChannel++" from "++destination++":"++destinationChannel++" was unsuccessful!"); + }); + }); +}; + +// connect a port +~jackConnectPort = { + arg source, sourceChannel, destination, destinationChannel; + ("jack_connect "++source++":"++sourceChannel++" "++destination++":"++destinationChannel).unixCmd({ + arg exitCode; + if(exitCode != 0, { + postln("Connecting "++source++":"++sourceChannel++" from "++destination++":"++destinationChannel++" was unsuccessful!"); + }); + }); +}; + +// returns the amount of ports of a given client +~jackClientPorts = { + arg clientName; + ("jack_lsp "++clientName++"| wc -l").unixCmdGetStdOut.asInt; +}; + +// adds one or more channels to Server.local.options.num{In,Out}putBusChannels +// makes the tuple available in ~additionalChannels Dictionairy +~addAdditionalChannels = { + arg type, name, channels; + if( name.class == Symbol && channels.isArray, { + switch (type, + \input, { + ~additionalChannels.at(\inputs).add(name -> channels); + postln("Added additional input channels for '"++name++"': "++channels.asString); + Server.local.options.numInputBusChannels = Server.local.options.numInputBusChannels + channels.size; + postln("Setting numInputBusChannels to "++Server.local.options.numInputBusChannels); + }, + \output, { + ~additionalChannels.at(\outputs).add(name -> channels); + postln("Added additional output channels for '"++name++"': "++channels.asString); + Server.local.options.numOutputBusChannels = Server.local.options.numOutputBusChannels + channels.size; + postln("Setting numOutputBusChannels to "++Server.local.options.numOutputBusChannels); + }, + { postln("Expecting \input or \output as type, got "++type.asString); + }); + },{ + postln('Expecting type Symbol for name and type Array for channels.'); + }); +}; -- cgit v1.2.3-54-g00ecf From 3335ef4b505a2a6e423516ec0aec1865231b987a Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 20:05:14 +0100 Subject: .config/SuperCollider/functions.scd: Adding SSR specific helper functions. Adding TODOs. --- .config/SuperCollider/functions.scd | 75 ++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/.config/SuperCollider/functions.scd b/.config/SuperCollider/functions.scd index fecd1a0..731760a 100644 --- a/.config/SuperCollider/functions.scd +++ b/.config/SuperCollider/functions.scd @@ -2,7 +2,7 @@ postln('Loading custom functions.'); /* * JACK specific helper functions - * + * TODO: move to Quark */ // disconnect a port ~jackDisconnectPort = { @@ -32,11 +32,15 @@ postln('Loading custom functions.'); ("jack_lsp "++clientName++"| wc -l").unixCmdGetStdOut.asInt; }; +/* + * SuperCollider specific helper functions + * + */ // adds one or more channels to Server.local.options.num{In,Out}putBusChannels // makes the tuple available in ~additionalChannels Dictionairy ~addAdditionalChannels = { arg type, name, channels; - if( name.class == Symbol && channels.isArray, { + if( name.isKindOf(Symbol) && channels.isArray, { switch (type, \input, { ~additionalChannels.at(\inputs).add(name -> channels); @@ -56,3 +60,70 @@ postln('Loading custom functions.'); postln('Expecting type Symbol for name and type Array for channels.'); }); }; + +/* + * SSR specific helper functions + * TODO: move to Quark + */ + +// sets up the necessary OSC connection for an existing local or remote SSR +// instance, subscribes to it and returns the NetAddr associated with it +~ssrSetupOSC = { + arg host="localhost", port=50001; + var ssr; + // set ssr of the client instance + ssr = NetAddr(host, port); + // answer /poll messages with an /alive answer + OSCdef( + \pollreply, + { + arg msg, time, addr, recvPort; + ~ssr.sendMsg("/alive"); + }, + '/poll', + ssr + ); + // subscribe to server with MessageLevel::SERVER + ssr.sendMsg("/subscribe", $T, 2); + ssr; +}; + +// clears the SSR scene, unsubscribes from the instance and removes alive +// answers OSCdef +~ssrDismantleOSC = { + arg ssr; + if (ssr.isKindOf(NetAddr), { + // remove all sources + ssr.sendMsg("/scene/clear"); + // unsubscribe from server + ssr.sendMsg("/subscribe", $F); + // disable alive answers + OSCdef(\alive).disable; + }); +}; + +// adds a source to an SSR instance +~ssrAddSource = { + arg ssr, name, model = "point", port, x = 0.0, y = 0.0, orientation = 0.0, + gain = 0.0, movability = $F, orientationMovability = $F, mute = $F; + if (ssr.isKindOf(NetAddr), { + if (name.isString, { + if (model.isString, { + if (port.isString, { + ssr.sendMsg("/source/new", name, model, port, x, y, orientation, + gain, movability, orientationMovability, mute) + },{ + error("The port argument is not of type String: "++port.class); + }); + },{ + error("The model argument is not of type String: "++model.class); + }); + },{ + error("The name argument is not of type String: "++name.class); + }); + },{ + error("The ssr argument is not of type NetAddr: "++ssr.class); + }); +}; + + -- cgit v1.2.3-54-g00ecf From c1e5d08d58034c8b53d4789dd32983016f4a5456 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 3 Mar 2019 22:09:51 +0100 Subject: .config/SuperCollider/functions.scd: Minor style fixes and adding of a convenience function for MIDI, to map to a given Bus. --- .config/SuperCollider/functions.scd | 51 ++++++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/.config/SuperCollider/functions.scd b/.config/SuperCollider/functions.scd index 731760a..3f27e31 100644 --- a/.config/SuperCollider/functions.scd +++ b/.config/SuperCollider/functions.scd @@ -40,7 +40,7 @@ postln('Loading custom functions.'); // makes the tuple available in ~additionalChannels Dictionairy ~addAdditionalChannels = { arg type, name, channels; - if( name.isKindOf(Symbol) && channels.isArray, { + if( (name.isKindOf(Symbol) && channels.isArray), { switch (type, \input, { ~additionalChannels.at(\inputs).add(name -> channels); @@ -54,10 +54,10 @@ postln('Loading custom functions.'); Server.local.options.numOutputBusChannels = Server.local.options.numOutputBusChannels + channels.size; postln("Setting numOutputBusChannels to "++Server.local.options.numOutputBusChannels); }, - { postln("Expecting \input or \output as type, got "++type.asString); - }); + { error("Expecting \input or \output as type, got "++type.asString); + }); },{ - postln('Expecting type Symbol for name and type Array for channels.'); + error('Expecting type Symbol for name and type Array for channels.'); }); }; @@ -126,4 +126,47 @@ postln('Loading custom functions.'); }); }; +/* + * MIDI specific helper functions + * TODO: move to Quark + */ +// map inputs of a given MIDI device's control messages to the values on a +// control Bus +~midiControlToBus = { + arg key, msgNum, chan, uid, bus; + if(key.isKindOf(Symbol),{ + if((msgNum.isArray),{ + if (chan.isInteger, { + if (uid.isInteger, { + if (bus.isKindOf(Bus), { + MIDIdef.new( + key: key, + func: { + arg ...args; + bus.setAt( + msgNum.indexOf(args[1].asInteger), + args[0].asInteger.lincurve(0, 127, 0.0, 1.0, 4, nil) + ); + }, + msgNum: msgNum, + chan: chan, + msgType: \control, + srcID: uid + ); + },{ + error('Argument bus must be of type Bus: '++bus.class); + }); + },{ + error('Argument uid must be of type Integer: '++uid.class); + }); + },{ + error('Argument chan must be of type Integer: '++chan.class); + }); + },{ + error('Argument msgNum must be of type Array: '++msgNum.class); + }); + },{ + error('Argument key must be of type Symbol: '++key.class); + }); +}; -- cgit v1.2.3-54-g00ecf