chore: cleaned up unused files

This commit is contained in:
Patrick Großmann 2023-05-02 22:11:27 +09:00
parent 6866a1e19d
commit 9bd58a7f24
Signed by: patrick
GPG key ID: 451F95EFB8BECD0F
9 changed files with 0 additions and 1294 deletions

View file

@ -1,92 +0,0 @@
MOD: TAGS: pkgs:
{
# ${MOD} will be set to the main modifier key
# General
"${MOD}-q" = " close";
# Moving
"${MOD}-Shift-Left" = " shift left";
"${MOD}-Shift-Down" = " shift down";
"${MOD}-Shift-Up" = " shift up";
"${MOD}-Shift-Right" = " shift right";
"${MOD}-Shift-n" = " shift left";
"${MOD}-Shift-r" = " shift down";
"${MOD}-Shift-l" = " shift up";
"${MOD}-Shift-s" = " shift right";
# Resizing
"${MOD}-Control-Left" = " resize left +$RESIZE_STEP";
"${MOD}-Control-Down" = " resize down +$RESIZE_STEP";
"${MOD}-Control-Up" = " resize up +$RESIZE_STEP";
"${MOD}-Control-Right" = " resize right +$RESIZE_STEP";
"${MOD}-Control-n" = " resize left +$RESIZE_STEP";
"${MOD}-Control-r" = " resize down +$RESIZE_STEP";
"${MOD}-Control-l" = " resize up +$RESIZE_STEP";
"${MOD}-Control-s" = " resize right +$RESIZE_STEP";
"${MOD}-Shift-Control-Left" = " resize right -$RESIZE_STEP";
"${MOD}-Shift-Control-Down" = " resize up -$RESIZE_STEP";
"${MOD}-Shift-Control-Up" = " resize down -$RESIZE_STEP";
"${MOD}-Shift-Control-Right" = " resize left -$RESIZE_STEP";
"${MOD}-Shift-Control-s" = " resize right -$RESIZE_STEP";
"${MOD}-Shift-Control-l" = " resize up -$RESIZE_STEP";
"${MOD}-Shift-Control-r" = " resize down -$RESIZE_STEP";
"${MOD}-Shift-Control-n" = " resize left -$RESIZE_STEP";
# Focusing
"${MOD}-Left" = " focus left";
"${MOD}-Down" = " focus down";
"${MOD}-Up" = " focus up";
"${MOD}-Right" = " focus right";
# Focusing
"${MOD}-n" = " focus left";
"${MOD}-r" = " focus down";
"${MOD}-l" = " focus up";
"${MOD}-s" = " focus right";
"Alt-Tab" = " cycle_all +1";
"Alt-Shift-Tab" = " cycle_all -1";
"${MOD}-BackSpace" = " cycle_monitor";
"${MOD}-c" = " cycle";
"${MOD}-i" = " jumpto urgent";
"${MOD}-Tab" = " cycle_all +1";
"${MOD}-Shift-Tab" = " cycle_all -1";
# Tag cycle
"${MOD}-period" = " use_index +1 ";
"${MOD}-comma" = " use_index -1 ";
# Splitting frames
"${MOD}-x" = " split bottom";
"${MOD}-v" = " split right";
"${MOD}-Control-space" = " split explode";
# Layouting
"${MOD}-Return" = " fullscreen toggle";
"${MOD}-shift-x" = " remove";
"${MOD}-f" = " floating toggle";
"${MOD}-p" = " pseudotile toggle";
"${MOD}-space" = " cycle_layout +1";
"${MOD}-Shift-space" = " cycle_layout -1";
"${MOD}-t " = "spawn kitty";
"${MOD}-b " = "spawn ${pkgs.firefox}/bin/firefox";
"${MOD}-m " = "spawn ${pkgs.thunderbird}/bin/thunderbird";
"${MOD}-Shift-l " = "spawn systemctl suspend";
"Menu" = "spawn rofi -show drun";
"${MOD}-F12" = "spawn ${(import ../../modules/touchscreen.nix) pkgs}";
}
// builtins.listToAttrs (map (x: {
name = "${MOD}-${x}";
value = "use_index ${x}";
})
TAGS)
// builtins.listToAttrs (map (x: {
name = "${MOD}-Shift-${x}";
value = "move_index ${x}";
})
TAGS)

View file

@ -1,17 +0,0 @@
#!/bin/bash
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
xrdb load "${HOME}/.Xresources"
xset m 1 0
#syndaemon -d -i 1.2 -t -K
xsetroot -solid '#000000'
#echo disabled > /sys/bus/usb/devices/1-1/power/wakeup
#
#touchegg &
#dunst &
autorandr -c
xset r rate 235 60
exec dbus-launch --sh-syntax --exit-with-session -- herbstluftwm --locked

View file

@ -1,21 +0,0 @@
{
# Configure keymap in X11
services.xserver = {
enable = true;
displayManager.startx.enable = true;
autoRepeatDelay = 235;
autoRepeatInterval = 60;
videoDrivers = ["modesetting"];
libinput = {
enable = true;
mouse.accelProfile = "flat";
touchpad = {
accelProfile = "flat";
accelSpeed = "0.5";
naturalScrolling = true;
disableWhileTyping = true;
};
};
};
services.autorandr.enable = true;
}

View file

@ -1,127 +0,0 @@
{
config,
pkgs,
...
}: {
programs.autorandr = let
dpi_hd = 96;
dpi_uhd = 216;
set_dpi = dpi: "echo 'Xft.dpi: ${toString dpi}' | ${pkgs.xorg.xrdb}/bin/xrdb -merge";
eDP-1 = "00ffffffffffff0006afeb3000000000251b0104a5221378020925a5564f9b270c50540000000101010101010101010101010101010152d000a0f0703e803020350058c11000001852d000a0f07095843020350025a51000001800000000000000000000000000000000000000000002001430ff123caa8f0e29aa202020003e";
# AStA config as function as we want to enable it for two different setups
asta_conf = {
DP-1-1,
DP-1-2,
}: {
fingerprint = {
inherit eDP-1 DP-1-1 DP-1-2;
};
config = {
eDP-1 = {
enable = true;
primary = true;
mode = "3840x2160";
position = "0x0";
gamma = "1";
};
DP-1-1 = {
enable = true;
mode = "1920x1080";
position = "3840x0";
rate = "60";
gamma = "1";
};
DP-1-2 = {
enable = true;
mode = "1920x1080";
position = "5760x0";
rate = "60";
gamma = "1";
};
};
hooks.postswitch = set_dpi dpi_hd;
};
in {
enable = true;
hooks.postswitch = {
"reload_wm" = "herbstclient reload";
};
profiles.AStA_links = asta_conf {
# AStA linker arbeitsplatz linker Monitor
DP-1-1 = "00ffffffffffff000472ed0688687101111e010380351e782aa135a35b4fa327115054b30c00714f818081c081009500b300d1c001012a4480a070382740082098040f282100001a023a801871382d40582c45000f282100001e000000fd00304b1e5512000a202020202020000000fc00423234375920430a202020202001cf020327f14b9002030411121300001f01230907078301000065030c001000681a00000101304be6023a801871382d40582c45000f282100001e8c0ad08a20e02d10103e96000f2821000018011d007251d01e206e2855000f282100001e8c0ad090204031200c4055000f282100001800000000000000000000000000000000d0";
# AStA linker arbeitsplatz rechter Monitor
DP-1-2 = "00ffffffffffff000472ed0682687101111e010380351e782aa135a35b4fa327115054b30c00714f818081c081009500b300d1c001012a4480a070382740082098040f282100001a023a801871382d40582c45000f282100001e000000fd00304b1e5512000a202020202020000000fc00423234375920430a202020202001d5020327f14b9002030411121300001f01230907078301000065030c001000681a00000101304be6023a801871382d40582c45000f282100001e8c0ad08a20e02d10103e96000f2821000018011d007251d01e206e2855000f282100001e8c0ad090204031200c4055000f282100001800000000000000000000000000000000d0";
};
profiles.AStA_rechts = asta_conf {
# AStA rechter arbeitsplatz linker Monitor
DP-1-1 = "00ffffffffffff000472ed068d687101111e010380351e782aa135a35b4fa327115054b30c00714f818081c081009500b300d1c001012a4480a070382740082098040f282100001a023a801871382d40582c45000f282100001e000000fd00304b1e5512000a202020202020000000fc00423234375920430a202020202001ca020327f14b9002030411121300001f01230907078301000065030c001000681a00000101304be6023a801871382d40582c45000f282100001e8c0ad08a20e02d10103e96000f2821000018011d007251d01e206e2855000f282100001e8c0ad090204031200c4055000f282100001800000000000000000000000000000000d0";
# AStA rechter arbeitsplatz rechter Monitor
DP-1-2 = "00ffffffffffff000472ed0680687101111e010380351e782aa135a35b4fa327115054b30c00714f818081c081009500b300d1c001012a4480a070382740082098040f282100001a023a801871382d40582c45000f282100001e000000fd00304b1e5512000a202020202020000000fc00423234375920430a202020202001d7020327f14b9002030411121300001f01230907078301000065030c001000681a00000101304be6023a801871382d40582c45000f282100001e8c0ad08a20e02d10103e96000f2821000018011d007251d01e206e2855000f282100001e8c0ad090204031200c4055000f282100001800000000000000000000000000000000d0";
};
profiles.laptop = {
fingerprint = {
inherit eDP-1;
};
config = {
eDP-1 = {
enable = true;
primary = true;
mode = "3840x2160";
position = "0x0";
gamma = "1";
};
};
hooks.postswitch = set_dpi dpi_uhd;
};
profiles.home = {
fingerprint = {
inherit eDP-1;
# Acer Predator Main Monitor
DP-1 = "00ffffffffffff00047290046bd08073261b0103803c227806ee91a3544c99260f505421080001010101010101010101010101010101565e00a0a0a029503020350056502100001a000000ff0023415350377974452f36413764000000fd001e9022de3b000a202020202020000000fc00584232373148550a202020202001750203204143030201230907018301000067030c001000007867d85dc40178c8005aa000a0a0a046503020350056502100001a6fc200a0a0a055503020350056502100001a6be600a0a0a0425030203a0056502100001e5a8700a0a0a03b503020350056502100001a1c2500a0a0a011503020350056502100001a00000000003c";
};
config = {
eDP-1 = {
enable = true;
primary = true;
mode = "3840x2160";
position = "2560x0";
gamma = "1";
};
DP-1 = {
enable = true;
mode = "2560x1440";
position = "0x0";
rate = "144";
gamma = "1";
};
};
hooks.postswitch = set_dpi dpi_hd;
};
profiles.TutoriumMI = {
fingerprint = {
inherit eDP-1;
# Beamer 2.11.18
DP-2 = "00ffffffffffff004ca30ba701010101081a0103800000780ade50a3544c99260f5054a10800814081c0950081809040b300a9400101283c80a070b023403020360040846300001a9e20009051201f304880360040846300001c000000fd0017550f5c11000a202020202020000000fc004550534f4e20504a0a202020200115020328f151901f202205140413030212110706161501230907078301000066030c00300080e200fb023a801871382d40582c450040846300001e011d801871382d40582c450040846300001e662156aa51001e30468f330040846300001e302a40c8608464301850130040846300001e00000000000000000000000000000070";
};
config = {
eDP-1 = {
enable = true;
primary = true;
mode = "3840x2160";
position = "0x0";
gamma = "1";
};
DP-2 = {
enable = true;
mode = "1920x1080";
position = "0x0";
rate = "144";
gamma = "1";
};
};
hooks.postswitch = set_dpi dpi_uhd;
};
};
}

View file

@ -1,85 +0,0 @@
{
config,
pkgs,
lib,
...
}: let
# set the modifier key to WIN
MOD = "Super";
#set the default resize step for herbstluft
RESIZE_STEP = 0.05;
TAGS = map toString (lib.lists.range 1 9);
data_dir = ../../../data/herbstluftwm;
in {
home.file.".xinitrc".source = data_dir + /xinitrc;
xsession.windowManager.herbstluftwm = {
enable = true;
package = pkgs.herbstluftwm.overrideAttrs (finalAttrs: previousAttrs: {
doCheck = false;
});
extraConfig = ''
herbstclient set auto_detect_monitors 1
killall polybar
polybar &
herbstclient attr theme.tiling.reset 1
herbstclient attr theme.floating.reset 1
herbstclient attr theme.active.color "#9fbc00"
herbstclient attr theme.normal.color "#454545"
herbstclient attr theme.urgent.color orange
herbstclient attr theme.inner_width 1
herbstclient attr theme.inner_color black
herbstclient attr theme.border_width 3
herbstclient attr theme.floating.border_width 4
herbstclient attr theme.floating.outer_width 1
herbstclient attr theme.floating.outer_color black
herbstclient attr theme.active.inner_color "#3E4A00"
herbstclient attr theme.active.outer_color "#3E4A00"
herbstclient attr theme.background_color "#141414"
'';
tags = TAGS;
mousebinds = {
"${MOD}-Button1" = "move";
"${MOD}-Button2" = "zoom";
"${MOD}-Button3" = "resize";
};
keybinds = import (data_dir + /keybinds.nix) MOD TAGS pkgs;
settings = {
"default_frame_layout" = 3;
"frame_border_active_color" = "#222222";
"frame_border_normal_color" = "#101010";
"frame_bg_normal_color" = "#565656";
"frame_bg_active_color" = "#345F0C";
"frame_border_width" = 1;
"always_show_frame" = 1;
"frame_bg_transparent" = 1;
"frame_transparent_width" = 5;
"frame_gap" = 4;
"window_gap" = 0;
"frame_padding" = 0;
"smart_window_surroundings" = 0;
"smart_frame_surroundings" = 1;
"mouse_recenter_gap" = 0;
"tree_style" = " ";
};
rules = [
# Focus new clients by default
"focus=on"
# Focus dialogs
"windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on"
# Do not manage windows of type NOTIFICATION, DOCK, DESKTOP
"windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off"
# Use pseudotiles for windows of type DIALOG, UTILITY, SPLASH
"windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on"
];
};
}

View file

@ -1,361 +0,0 @@
# Polybar config
# Polybar is kinda weird in two regards:
# 1. polybar allows a superkey and subkey to both have values eg:
# a = "lel"
# a.b = "lul"
# since nix does not allow this you have to hardcode the key with a '-'
# instead of using actual nix subkeys witt '.' eg:
# a = "lel"
# a-b = "lul"
# 2. polybar allows integer keys. In nix these have to be quoted
{
lib,
pkgs,
...
}: let
color = {
shade1 = "#311B92";
shade2 = "#4527A0";
shade3 = "#512DA8";
shade4 = "#5E35B1";
shade5 = "#673AB7";
shade6 = "#7E57C2";
shade7 = "#9575CD";
shade8 = "#B39DDB";
bground = "#1D1F28";
fground = "#f7f7f7";
borderbg = "#f7f7f7";
accent = "#5E35B1";
modulefg = "#f7f7f7";
modulefg-alt = "#f7f7f7";
trans = "#00000000";
white = "#FFFFFF";
black = "#000000";
# Material Colors
red = "#e53935";
pink = "#d81b60";
purple = "#8e24aa";
deep-purple = "#5e35b1";
indigo = "#3949ab";
blue = "#1e88e5";
light-blue = "#039be5";
cyan = "#00acc1";
teal = "#00897b";
green = "#43a047";
light-green = "#7cb342";
lime = "#c0ca33";
yellow = "#fdd835";
amber = "#ffb300";
orange = "#fb8c00";
deep-orange = "#f4511e";
brown = "#6d4c41";
grey = "#757575";
blue-gray = "#546e7a";
};
fontsize = "9";
in {
services.polybar = {
enable = true;
package = pkgs.polybar.override {
pulseSupport = true;
alsaSupport = true;
iwSupport = true;
};
script = "polybar main @";
settings = {
"bar/main" = {
monitor = "DP-1";
monitor-fallback = "eDP-1";
bottom = true;
# for UHD Polybar
dpi = 144;
height = 33;
# for HD Polybar
#dpi = 96;
#height = 22;
offset.x = "0%";
offset.y = "0%";
background = color.bground;
foreground = color.fground;
font = {
"0" = "FiraCode Nerd Font Mono:style=Medium:size=${fontsize};2";
"1" = "";
"2" = "Iosevka Nerd Font:style=Medium:size=12;2";
"3" = "Font Awesome 5 Pro:style=Solid:size=${fontsize}";
"4" = "FontAwesome:style=Regular:size=${fontsize};2";
"5" = "Font Awesome 5 Pro:style=Light:size=${fontsize}";
};
modules = with lib; {
left = concatStringsSep " " ["left1" "title" "left2"];
center = concatStringsSep " " ["workspaces"];
right = concatStringsSep " " ["right5" "alsa" "right4" "battery" "right3" "network" "right2" "date" "right1" "keyboardswitcher"];
};
tray = {
position = "right";
background = color.shade1;
};
enable.ipc = true;
};
# Functional MODULES
"module/title" = {
type = "internal/xwindow";
format = "<label>";
format-background = color.shade2;
format-foreground = color.modulefg;
format-padding = "1";
label = "%title%";
label-maxlen = "30";
label-empty = "NixOS";
label-empty-foreground = "#707880";
};
"module/workspaces" = {
type = "internal/xworkspaces";
pin.workspaces = "false";
enable.click = "true";
enable.scroll = "false";
label.active = "%{T1}%{T-}";
label.occupied = "%{T1}%{T-}";
label.urgent = "%{T1}%{T-}";
label.empty = "%{T1}%{T-}";
format = "<label-state>";
label.monitor = "%name%";
label.active-foreground = color.accent;
label.occupied-foreground = color.yellow;
label.urgent-foreground = color.red;
label.empty-foreground = color.modulefg-alt;
label.active-padding = "1";
label.urgent-padding = "1";
label.occupied-padding = "1";
label.empty-padding = "1";
};
"module/alsa" = {
type = "internal/pulseaudio";
format.volume = "<ramp-volume> <label-volume>";
format.volume-background = color.shade5;
format.volume-foreground = color.modulefg;
format.volume-padding = "1";
label.volume = "%percentage%%";
format.muted.prefix = "%{T1}%{T-}";
label.muted = " Mute";
format.muted.background = color.shade5;
format.muted.foreground = color.modulefg;
format.muted.padding = "1";
ramp.volume."0" = "%{T1}%{T-}";
ramp.volume."1" = "%{T1}奔%{T-}";
ramp.volume."2" = "%{T1}%{T-}";
};
"module/battery" = {
type = "internal/battery";
full.at = "99";
battery = "BAT0";
adapter = "ADP1";
poll.interval = "2";
time.format = "%H:%M";
format.charging = "<animation-charging> <label-charging>";
format.charging-background = color.shade4;
format.charging-foreground = color.modulefg;
format.charging-padding = "1";
format.discharging = "<ramp-capacity> <label-discharging>";
format.discharging-background = color.shade4;
format.discharging-foreground = color.modulefg;
format.discharging-padding = "1";
label.charging = "%percentage%%";
label.discharging = "%percentage%%";
label.full = "Fully Charged";
label.full-background = color.shade4;
label.full-foreground = color.modulefg;
label.full-padding = "1";
# Capacity ramp
ramp.capacity.font = "5";
ramp.capacity."0" = " %{T1}warning%{T-} ";
ramp.capacity."0-foreground" = "#000000";
ramp.capacity."0-background" = "#df2c00";
ramp.capacity."1" = "";
ramp.capacity."1-foreground" = "#df2c00";
ramp.capacity."2" = "";
ramp.capacity."2-foreground" = "#df4c00";
ramp.capacity."3" = "";
ramp.capacity."3-foreground" = "#df8c00";
ramp.capacity."4" = "";
ramp.capacity."4-foreground" = "#dfcc00";
ramp.capacity."5" = "";
ramp.capacity."5-foreground" = "#dfcc00";
ramp.capacity."6" = "";
ramp.capacity."7" = "";
ramp.capacity."8" = "";
ramp.capacity."9" = "";
animation.charging.font = "5";
animation.charging."0" = "";
animation.charging."1" = "";
animation.charging."2" = "";
animation.charging."3" = "";
animation.charging."4" = "";
animation.charging."5" = "";
animation.charging."6" = "";
animation.charging."7" = "";
animation.charging."8" = "";
animation.charging.framerate = "750";
};
"module/date" = {
type = "internal/date";
interval = "1.0";
format = "<label>";
format-background = color.shade2;
format-foreground = color.modulefg;
format-padding = "1";
label = "%date% %time%";
# Normal date and time format
#date.alt = "%%{T5}%%{T-} %{F#808080}%Y.%m.%{F.}%d";
#time.alt = "%%{T5}%%{T-} %H:%M";
# Alternative date and time format
date = "%{T5}%{T-} %a, %d %{F#808080}%b %Y%{F-}";
time = "%{T5}%{T-} %H:%M:%S";
};
"module/network" = {
type = "internal/network";
interface = "wlan0";
interval = "1.0";
accumulate.stats = "true";
unknown.as.up = "true";
format-connected = "<label-connected>";
format-connected-background = color.shade3;
format-connected-foreground = color.modulefg;
format-connected-padding = "1";
label.connected = "%{F#808080}%ifname%%{F-} %{F#808080}%upspeed:8% %downspeed:8% %{F-}";
format.disconnected = "<label-disconnected>";
format.disconnected-background = color.shade3;
format.disconnected-foreground = color.modulefg;
format.disconnected-padding = "1";
};
"module/keyboardswitcher" = {
type = "custom/menu";
expand.right = "true";
format.background = color.shade1;
format.foreground = color.modulefg;
label.open = "%{T3} %{T-}";
label.close = " x ";
label.separator = " | ";
menu."0"."0" = "bone";
menu."0"."0-exec" = "/usr/bin/setxkbmap de bone";
menu."0"."1" = "neo";
menu."0"."1-exec" = "/usr/bin/setxkbmap de neo";
menu."0"."2" = "qwertz";
menu."0"."2-exec" = "/usr/bin/setxkbmap de";
};
# AESTHETIC MODULES
"module/left1" = {
type = "custom/text";
"content-background" = color.shade2;
"content-foreground" = color.shade1;
content = "%{T3}%{T-}";
};
"module/left2" = {
type = "custom/text";
"content-background" = color.bground;
"content-foreground" = color.shade2;
content = "%{T3}%{T-}";
};
"module/right1" = {
type = "custom/text";
"content-background" = color.shade2;
"content-foreground" = color.shade1;
content = "%{T3}%{T-}";
};
"module/right2" = {
type = "custom/text";
"content-background" = color.shade3;
"content-foreground" = color.shade2;
content = "%{T3}%{T-}";
};
"module/right3" = {
type = "custom/text";
"content-background" = color.shade4;
"content-foreground" = color.shade3;
content = "%{T3}%{T-}";
};
"module/right4" = {
type = "custom/text";
"content-background" = color.shade5;
"content-foreground" = color.shade4;
content = "%{T3}%{T-}";
};
"module/right5" = {
type = "custom/text";
"content-background" = color.bground;
"content-foreground" = color.shade5;
content = "%{T3}%{T-}";
};
"module/right6" = {
type = "custom/text";
"content-background" = color.shade7;
"content-foreground" = color.shade6;
content = "%{T3}%{T-}";
};
"module/right7" = {
type = "custom/text";
"content-background" = color.bground;
"content-foreground" = color.shade7;
content = "%{T3}%{T-}";
};
};
};
}

View file

@ -1,45 +0,0 @@
{
config,
pkgs,
lib,
...
}: {
imports = [
./starfish.nix
];
programs.atuin = {
enable = true;
settings.auto_sync = false;
};
programs.fish = with lib; {
enable = true;
interactiveShellInit = lib.mkMerge [
(lib.mkBefore ''
set -g ATUIN_NOBIND true
set -g fish_greeting
set -g fish_autosuggestion_enabled 0
'')
(lib.mkAfter ''
bind \cr _atuin_search
# prefix search for up and down arrow
bind \e\[A history-prefix-search-backward
bind \e\[B history-prefix-search-forward
#Include atuin auto completions
atuin gen-completions --shell fish | source
set -g fzf_complete_opts --cycle --reverse --height=20%
'')
];
plugins = [
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "oddlama";
repo = "fzf.fish";
rev = "8c8b21ae52306cab5cece0095802ae15d0b8e3f4";
sha256 = "07yhiqv2ag4k7fxrmqg8x66adr3gy5j1w2cs07pm0f1552jsz5jr";
};
}
];
};
}

View file

@ -1,540 +0,0 @@
{
config,
pkgs,
lib,
...
}:
with lib; let
#
# GESTURES
#
# each on has a member type as a single entry enum
# to be able to definitely distinguish them
# common options
fingers = mkOption {
type = types.ints.between 2 5;
description = ''
amount of simoultaneous fingers
needed to trigger the gesture
'';
default = 3;
example = "";
};
# Submodules for the different gestures
swipe_gesture = types.submodule {
inherit fingers;
type = mkOption {
type = types.enum ["swipe"];
description = ''
Type of gesture to perform
'';
default = "";
};
direction = mkOption {
type = types.enum ["UP" "DOWN" "LEFT" "RIGHT"];
description = ''
the swipe direction
'';
example = "UP";
};
};
pinch_gesture = types.submodule {
inherit fingers;
type = mkOption {
type = types.enum ["pinch"];
description = ''
Type of gesture to perform
'';
default = "";
};
direction = mkOption {
type = types.enum ["IN" "OUT"];
description = ''
the pinch direction
'';
example = "IN";
};
};
tap_gesture = types.submodule {
inherit fingers;
type = mkOption {
type = types.enum ["tap"];
description = ''
Type of gesture to perform
'';
default = "";
};
};
#
# ACTIONS
#
# common options
animate = mkOption {
type = tyes.bool;
description = ''
Whether to display the animation
'';
default = false;
};
color = mkOption {
type = types.str;
description = ''
hex value of the animation color
'';
default = "3E9FED";
example = "909090";
};
borderColor = mkOption {
type = types.str;
description = ''
hex value of the color of the
animation border
'';
default = "3E9FED";
example = "FF90FF";
};
animation_common_options = {
inherit animate color borderColor;
};
maximize_restore_window = {
inherit animation_common_options;
};
minimize_restore_window = {
};
tile_window = {
inherit animation_common_options;
direction = mkOption {
type = types.enum ["left" "right"];
description = ''
Which side of the screen to snap to
'';
default = "";
example = "left";
};
};
fullscreen_window = {
inherit animation_common_options;
};
close_window = {
inherit animation_common_options;
};
change_desktop = {
inherit animation_common_options;
direction = mkOption {
type = types.enum [
"previous"
"next"
"up"
"down"
"left"
"right"
"auto"
];
description = ''
The desktop/workspace to switch to.
It is recommended to use previous/next for better compatibility.
However, some desktop environments, like KDE,
allow to configure a grid of desktops and up/down/left/right come in handy.
With SWIPE gestures, auto will use your natural scroll preferences to figure out the direction.
'';
default = "auto";
example = "next";
};
cyclic = mkOption {
type = types.bool;
description = ''
Set it to true when using
previous/next directions
to navigate from last
desktop to first desktop
or from first to last.
'';
default = true;
example = false;
};
animationPosition = mkOption {
type = types.enum ["up" "down" "left" "right" "auto"];
description = ''
Edge of the screen where the animation will be displayed. With SWIPE gestures, auto will use your natural scroll preferences to figure out the animation position.
'';
default = "auto";
example = "up";
};
};
show_desktop = {
inherit animation_common_options;
};
repeat = mkOption {
type = types.bool;
description = ''
Whether to execute the keyboard shortcut multiple times (default: false). This is useful to perform actions like pinch to zoom.
'';
default = false;
example = true;
};
on = mkOption {
type = types.enum ["begin" "end"];
description = ''
Only used when repeat is false. Whether to execute the shortcut at the beginning or at the end of the gesture.
'';
example = "begin";
default = "end";
};
times = mkOption {
type = types.ints.between 2 15;
description = ''
Only used when repeat is true. Number of times to repeat the action.
'';
example = 5;
};
animation = mkOption {
type = types.nullOr (types.enum [
"CHANGE_DESKTOP_UP"
"CHANGE_DESKTOP_DOWN"
"CHANGE_DESKTOP_LEFT"
"CHANGE_DESKTOP_RIGHT"
"CLOSE_WINDOW"
"MAXIMIZE_WINDOW"
"RESTORE_WINDOW"
"MINIMIZE_WINDOW"
"SHOW_DESKTOP"
"EXIST_SHOW_DESKTOP"
"TILE_WINDOW_LEFT"
"TILE_WINDOW_RIGHT"
]); # TODO
description = ''
Which animation to use
'';
default = "";
example = "TILE_WINDOW_RIGHT";
};
send_keys = {
inherit animation_common_options;
inherit repeat on times animation;
modifiers = mkOption {
type = types.str;
description = ''
Typical values are: Shift_L, Control_L, Alt_L, Alt_R, Meta_L, Super_L, Hyper_L. You can use multiple keysyms: Control_L+Alt_L. See X11 keysymdefs
'';
default = "";
example = "Shift_L";
};
keys = mkOption {
type = types.str;
description = ''
Shortcut keys. You can use multiple keysyms: A+B+C. See X11 keysymdefs.
'';
example = "A+c";
};
decreaseKeys = mkOption {
type = types.str;
description = ''
Only used when repeat is true. Keys to press when you change the gesture direction to the opposite. You can use multiple keysyms: A+B+C. This is useful to perform actions like pinch to zoom.
'';
example = "Y+Z";
};
};
run_command = {
inherit animation_common_options;
inherit repeat on times animation;
command = mkOption {
type = types.str;
description = ''
The command to execute
'';
default = "";
example = "ls -lah";
};
decreaseCommand = mkOption {
type = types.str;
description = ''
Only used when repeat is true. Keys to press when you change the gesture direction to the opposite. You can use multiple keysyms: A+B+C. This is useful to perform actions like pinch to zoom.
'';
example = "Y+Z";
};
};
mouse_click = {
inherit on;
button = mkOption {
type = types.enum ["left" "right" "middle"];
description = ''
Which button to press
'';
example = "left";
};
};
gestureModule = let
helpStr = ''
The gesture to trigger.
Only one of 'swipe_gesture' 'pinch_gesture' and 'tap_gesture'
can be defined
'';
in
types.submodule {
gestures = mkOption {
# hopefully this works it not
# because of submodule weirdness
type = types.enum [swipe_gesture pinch_gesture tap_gesture];
description = helpStr;
example = ""; # TODO
};
action = mkOption {
type =
types.oneOf [
];
description = ''
The actions to perform
'';
};
application = mkOption {
type = types.string;
description = ''
The name of the application
in which this gestures should trigger
'';
default = "ALL";
example = "Google-chrome,Chromium-browser";
};
};
in {
options.programs.touchegg = {
inherit color borderColor;
enable = mkEnableOption "Touch gesture daemon";
animation_delay = mkOption {
type = types.ints.unsigned;
description = ''
Delay, in milliseconds,
since the gesture starts
before the animation is displayed
'';
default = 150;
example = "";
};
action_execute_threshold = mkOption {
type = types.ints.between 0 100;
description = ''
Percentage of the
gesture to be completed
to apply the action.
Set to 0 to execute
actions unconditionally
'';
default = 20;
example = "";
};
gestures = mkOption {
type = types.attrsOf gestureModule;
description = "touchegg gestures";
default = {};
};
};
config = let
cfg = config.programs.touchegg;
in
mkIf cfg.enable {
# TODO
home.packages = [pkgs.touchegg];
xdg.configFile.touchegg = {
target = "touchegg/touchegg.conf";
text = ''
<touchégg>
<settings>
<!--
Delay, in milliseconds, since the gesture starts before the animation is displayed.
Default: 150ms if this property is not set.
Example: Use the MAXIMIZE_RESTORE_WINDOW action. You will notice that no animation is
displayed if you complete the action quick enough. This property configures that time.
-->
<property name="animation_delay">${cfg.animation_delay}</property>
<!--
Percentage of the gesture to be completed to apply the action. Set to 0 to execute actions unconditionally.
Default: 20% if this property is not set.
Example: Use the MAXIMIZE_RESTORE_WINDOW action. You will notice that, even if the
animation is displayed, the action is not executed if you did not move your fingers far
enough. This property configures the percentage of the gesture that must be reached to
execute the action.
-->
<property name="action_execute_threshold">${cfg.action_execute_threshold}</property>
<!--
Global animation colors can be configured to match your system colors using HEX notation:
<color>909090</color>
<borderColor>FFFFFF</borderColor>
You can also use auto:
<property name="color">auto</property>
<property name="borderColor">auto</property>
Notice that you can override an specific animation color.
-->
<property name="color">${cfg.color}</property>
<property name="borderColor">${cfg.borderColor}</property>
</settings>
<!--
Configuration for every application.
-->
<application name="All">
<gesture type="SWIPE" fingers="3" direction="UP">
<action type="MAXIMIZE_RESTORE_WINDOW">
<animate>true</animate>
</action>
</gesture>
<gesture type="SWIPE" fingers="3" direction="DOWN">
<action type="MINIMIZE_WINDOW">
<animate>true</animate>
</action>
</gesture>
<gesture type="SWIPE" fingers="3" direction="LEFT">
<action type="TILE_WINDOW">
<direction>left</direction>
<animate>true</animate>
</action>
</gesture>
<gesture type="SWIPE" fingers="3" direction="RIGHT">
<action type="TILE_WINDOW">
<direction>right</direction>
<animate>true</animate>
</action>
</gesture>
<gesture type="PINCH" fingers="3" direction="IN">
<action type="CLOSE_WINDOW">
<animate>true</animate>
<color>F84A53</color>
<borderColor>F84A53</borderColor>
</action>
</gesture>
<gesture type="SWIPE" fingers="4" direction="UP">
<action type="CHANGE_DESKTOP">
<direction>auto</direction>
<animate>true</animate>
<animationPosition>auto</animationPosition>
</action>
</gesture>
<gesture type="SWIPE" fingers="4" direction="DOWN">
<action type="CHANGE_DESKTOP">
<direction>auto</direction>
<animate>true</animate>
<animationPosition>auto</animationPosition>
</action>
</gesture>
<gesture type="SWIPE" fingers="4" direction="RIGHT">
<action type="SEND_KEYS">
<repeat>false</repeat>
<modifiers>Super_L</modifiers>
<keys>S</keys>
<on>begin</on>
</action>
</gesture>
<gesture type="PINCH" fingers="4" direction="OUT">
<action type="SHOW_DESKTOP">
<animate>true</animate>
</action>
</gesture>
<gesture type="PINCH" fingers="4" direction="IN">
<action type="SEND_KEYS">
<repeat>false</repeat>
<modifiers>Super_L</modifiers>
<keys>A</keys>
<on>begin</on>
</action>
</gesture>
<gesture type="TAP" fingers="2">
<action type="MOUSE_CLICK">
<button>3</button>
<on>begin</on>
</action>
</gesture>
<gesture type="TAP" fingers="3">
<action type="MOUSE_CLICK">
<button>2</button>
<on>begin</on>
</action>
</gesture>
</application>
<!--
Configuration for specific applications.
-->
<application name="Google-chrome,Chromium-browser">
<gesture type="PINCH" fingers="2" direction="IN">
<action type="SEND_KEYS">
<repeat>true</repeat>
<modifiers>Control_L</modifiers>
<keys>KP_Subtract</keys>
<decreaseKeys>KP_Add</decreaseKeys>
</action>
</gesture>
<gesture type="PINCH" fingers="2" direction="OUT">
<action type="SEND_KEYS">
<repeat>true</repeat>
<modifiers>Control_L</modifiers>
<keys>KP_Add</keys>
<decreaseKeys>KP_Subtract</decreaseKeys>
</action>
</gesture>
</application>
</touchégg>
'';
};
};
}

View file

@ -1,6 +0,0 @@
{config, ...}: {
#
# MY Config
#
programs.touchegg.enable = false;
}