M modules/desktop/qtile/config/config.py => modules/desktop/qtile/config/config.py +6 -6
@@ 17,7 17,7 @@ from tasklist import TaskList
from mpris2widget import Mpris2
from bluetooth import Bluetooth
import xmonadcustom
-from nixenvironment import setupLocation, configLocation
+from nixenvironment import setupLocation, configLocation, sequenceDetectorExec
colors = {
'primary': '51afef',
@@ 409,11 409,11 @@ keys.extend([
# media keys
keys.extend([
- EzKey('<XF86AudioPlay>', lazy.spawn('playerctl play')),
- EzKey('<XF86AudioPause>', lazy.spawn('playerctl pause')),
- EzKey('<XF86AudioStop>', lazy.spawn('playerctl stop')),
- EzKey('<XF86AudioNext>', lazy.spawn('playerctl next')),
- EzKey('<XF86AudioPrev>', lazy.spawn('playerctl previous')),
+ EzKey('<XF86AudioPlay>', lazy.spawn(f'{sequenceDetectorExec} -g mpris play')),
+ EzKey('<XF86AudioPause>', lazy.spawn(f'{sequenceDetectorExec} -g mpris pause')),
+ EzKey('<XF86AudioStop>', lazy.spawn(f'{sequenceDetectorExec} -g mpris stop')),
+ EzKey('<XF86AudioNext>', lazy.spawn(f'{sequenceDetectorExec} -g mpris next')),
+ EzKey('<XF86AudioPrev>', lazy.spawn(f'{sequenceDetectorExec} -g mpris prev')),
EzKey('<XF86AudioMute>', lazy.spawn('amixer -D pulse set Master 1+ toggle')),
EzKey('<XF86MonBrightnessUp>', lazy.spawn('xbacklight -inc 5')),
EzKey('<XF86MonBrightnessDown>', lazy.spawn('xbacklight -dec 5')),
A modules/desktop/qtile/config/sequence-detector.config.json => modules/desktop/qtile/config/sequence-detector.config.json +18 -0
@@ 0,0 1,18 @@
+{
+ "debounce_time": 500,
+ "groups": [
+ {
+ "group_id": "mpris",
+ "sequences": [
+ { "keys": ["next"], "action": "playerctl next" },
+ { "keys": ["prev"], "action": "playerctl previous" },
+ { "keys": ["play"], "action": "playerctl play" },
+ { "keys": ["pause"], "action": "playerctl pause" },
+ { "keys": ["volup"], "action": "amixer set Master 10%+ unmute" },
+ { "keys": ["voldown"], "action": "amixer set Master 10%- unmute" },
+ { "keys": ["next", "next"], "action": "playerctl --player=firefox play-pause" },
+ { "keys": ["next", "prev"], "action": "playerctl --player=spotify play-pause" }
+ ]
+ }
+ ]
+}
M modules/desktop/qtile/default.nix => modules/desktop/qtile/default.nix +0 -1
@@ 4,7 4,6 @@
imports = [(import ./python-overlay.nix)];
environment.systemPackages = with pkgs; [
- playerctl
xkblayout-state
];
M modules/desktop/qtile/home.nix => modules/desktop/qtile/home.nix +27 -2
@@ 1,12 1,34 @@
-{ config, lib, pkgs, location, ... }:
+{ config, lib, pkgs, user, location, ... }:
-{
+let
+ sequence-detector-src = pkgs.fetchFromGitHub {
+ owner = "Rutherther";
+ repo = "sequence-detector";
+ rev = "f9052a0232d8d4377446cb7aa813382977ed25a3";
+ hash = "sha256-YJ7U/G9EOGaf25zqTAMMGK0A6dY0wmtcpesp3d2uzTk=";
+ };
+
+ sequence-detector-pkg = pkgs.rustPlatform.buildRustPackage {
+ pname = "sequence-detector";
+ version = "0.1";
+ src = sequence-detector-src;
+ cargoHash = "sha256-7S8TXqtKWR4utBeUe9Q7RrmHgJg5lqkLdmo9b+MTRGg=";
+ hash = "sha256-7S8TXqtKWR4utBeUe9Q7RrmHgJg5lqkLdmo9b+MTRGg=";
+ };
+in {
# services.udev.extraRules =
# ''ACTION=="change", SUBSYSTEM=="drm", RUN+="${pkgs.autorandr}/bin/autorandr -c"'';
services.autorandr = {
enable = true;
};
+ home.packages = with pkgs; [
+ playerctl
+ sequence-detector-pkg
+ ];
+
+ services.playerctld.enable = true;
+
programs.autorandr = {
enable = true;
hooks = {
@@ 79,6 101,7 @@
xdg.configFile."qtile/mpris2widget.py".source = ./config/mpris2widget.py;
xdg.configFile."qtile/tasklist.py".source = ./config/tasklist.py;
xdg.configFile."qtile/xmonadcustom.py".source = ./config/xmonadcustom.py;
+ xdg.configFile."qtile/sequence-detector.config.json".source = ./config/sequence-detector.config.json;
xdg.configFile."qtile/nixenvironment.py".text = ''
from string import Template
@@ 89,5 112,7 @@ configLocationRef = Template("${location}/modules/desktop/qtile/config")
setupLocation = setupLocationRef.substitute(os.environ)
configLocation = configLocationRef.substitute(os.environ)
+
+sequenceDetectorExec = "sequence_detector -c /home/${user}/.config/qtile/sequence-detector.config.json "
'';
}