Day 2 of i3

This commit is contained in:
kat witch 2022-01-04 21:05:17 +00:00 committed by kat
parent 984fd2f69c
commit 29c6d142f8
Signed by: kat
GPG key ID: 465E64DECEA8CF0F
21 changed files with 904 additions and 581 deletions

View file

@ -4,7 +4,7 @@
profiles.hardware.razer
profiles.hardware.bamboo
profiles.gui
profiles.i3
profiles.x11
profiles.vfio
profiles.network
profiles.cross.aarch64
@ -117,6 +117,7 @@
".config/discord"
".config/obsidian"
".config/hedgedoc"
".config/obs-studio"
".ApacheDirectoryStudio"
".gnupg"
".mozilla"

View file

@ -17,9 +17,19 @@
modules.temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input";
};
};
polybarExtend = { config, ... }: {
services.polybar.settings."module/temp".hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input";
};
/*
polybarExtend2 = { config, ... }: {
config = {
modules."temperature#icon".hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input";
modules.temperature.hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon2/temp2_input";
};
};*/
in mkOption {
type = types.attrsOf (types.submoduleWith {
modules = singleton waybarExtend;
modules = [ waybarExtend polybarExtend ];
});
};

View file

@ -1,14 +0,0 @@
{ config, pkgs, ... }: {
services.xserver = {
enable = true;
autorun = false;
exportConfiguration = true;
displayManager.startx.enable = true;
};
environment.systemPackages = with pkgs; [
xorg.xinit
xsel
scrot
];
}

View file

@ -1,90 +0,0 @@
screens:
- monitor: # fill in with info from `screenstub detect`
manufacturer: BNQ
model: BenQ GW2270
#serial: "..."
guest_source: # Could be automatically detected, but best to fill in if monitor has more than two inputs
name: HDMI-1
#value: 0x0f # can also specify raw VCP value
host_source: # Usually automatically detected
name: HDMI-2
#value: 0x11
ddc:
#minimal_delay: 100ms # minimum time to wait between switching inputs again
#guest: [] # disable input switching
#host: [] # disable input switching
guest: # configure how to switch to the guest
- ddc # (default) Use ddc-rs
#exec: ["ddcutil", "-g", "BNQ", "setvcp", "0x60", "{}"]
#- exec: [ddccontrol, -r, "0x60", -w, "{}", /dev/i2c-5]
host: # configure how to switch back from the guest
- ddc # (default) Controls DDC from the host GPU - requires no guest agent but many monitors won't support this
#- exec: ["ddcutil", "-g", "BNQ", "setvcp", "0x60", "{}"]
#- guest_exec: ["C:/ddcset.exe", "setvcp", "60", "{:x}"] # or "0x{:x}" for hex input value
#- guest_exec: ["C:/ScreenBright.exe", "-set", "0x60", "{}"] # "{}" is for decimal input value
#- exec: ["ssh", "user@vm", "ddcutil", "setvcp", "0x60", "{}"] # system commands can also be used
qemu:
#routing: qmp # (default) does not require extra configuration or dependencies
#routing: spice # no external requirements # CURRENTLY UNIMPLEMENTED
#routing: input-linux # requires uinput
routing: virtio-host # requires uinput, recommended for performance, requires vioinput drivers in guest
#driver: ps2 # use PS/2 in the guest for all input devices (absolute mouse mode unsupported)
#driver: usb # use USB keyboard/mouse/tablet in the guest
#driver: virtio # Recommended but vioinput drivers must be installed in guest
keyboard_driver:
virtio:
bus: pci.23
relative_driver:
virtio:
bus: pci.22
absolute_driver:
virtio:
bus: pci.21
#driver: virtio
#relative_driver: virtio
qmp_socket: /tmp/vfio-qmp # path to QMP socket
ga_socket: /tmp/vfio-qga # path to Guest Agent socket
key_remap: # Arbitrary keys can be remapped in the guest
# See https://docs.rs/input-linux/*/input_linux/enum.Key.html for a list of key names available (mouse buttons can also be used)
LeftMeta: Reserved # disable the windows key
RightAlt: LeftMeta # remap right alt to trigger the windows key
hotkeys: # Trigger various events on key combinations
#- toggle_grab:y
# xdevice: # CURRENTLY UNIMPLEMENTED
# devices: # Only grab specific devices from Xorg
# - "..."
#- exec: [echo, hi] # Execute an arbitrary system command
#- show_host # switch to the host display
#- show_guest # switch to the guest display
#- toggle_show # switch the current display
#- unstick_guest # causes all held keys to be released in the guest
#- shutdown # safely shuts the guest system down
#- reboot # reboots the guest
#- exit # quits screenstub
- triggers: [Esc]
modifiers: [LeftMeta]
events:
- toggle_grab:
x:
mouse: false # Confine input/mouse to window
- toggle_grab:
evdev: # evdev grab is useful for playing games that don't work with absolute mouse events
exclusive: false # grab exclusive access from the device(s)
#new_device_name: "unique-grab-name" # create a new uinput device for this grab
xcore_ignore: [absolute] # which events to ignore from the window (key, button, absolute)
evdev_ignore: [button] # which events to ignore from the evdev device
devices: # List of devices to forward to guest
- /dev/input/by-id/usb-Razer_Razer_Naga_Trinity_00000000001A-event-mouse
- unstick_host # force-depress all Xorg keys (prevents keys getting stuck)
- triggers: [T]
modifiers: [LeftMeta]
on_release: false
events:
- toggle_show
exit_events: # Events to trigger on window close / exit
- show_host
#- shutdown

View file

@ -0,0 +1,7 @@
default partial alphanumeric_keys
xkb_symbols "basic" {
include "us(altgr-intl)"
name[Group1] = "English (US, international with pound sign)";
key <AD03> { [ e, E, EuroSign, cent ] };
key <AE03> { [ 3, numbersign, sterling] };
};

View file

@ -0,0 +1,21 @@
{ config, pkgs, ... }: {
services.xserver = {
enable = true;
autorun = false;
exportConfiguration = true;
displayManager = let
compiledLayout = pkgs.runCommand "keyboard-layout" {} ''
${pkgs.xorg.xkbcomp}/bin/xkbcomp ${./layout.xkb} $out
'';
in {
sessionCommands = "${pkgs.xorg.xkbcomp}/bin/xkbcomp ${compiledLayout} $DISPLAY";
startx.enable = true;
};
};
environment.systemPackages = with pkgs; [
xorg.xinit
xsel
scrot
];
}

@ -1 +1 @@
Subproject commit e5b12b6415a963ea0c86fc972ebe46c094c87504
Subproject commit fc7a2a7dea6f067bb3038ac01454030085b55097

View file

@ -2,7 +2,8 @@
{
home.packages = with pkgs; [
rink-readline
#rink-readline TODO: wait for fix
rink
];
xdg.configFile."rink/config.toml".text = lib.toTOML {

View file

@ -0,0 +1,7 @@
default partial alphanumeric_keys
xkb_symbols "basic" {
include "us(altgr-intl)"
name[Group1] = "English (US, international with pound sign)";
key <AD03> { [ e, E, EuroSign, cent ] };
key <AE03> { [ 3, numbersign, sterling] };
};

View file

@ -0,0 +1,9 @@
{ config, ... }:
{
home.file = {
".xkb/symbols/us_gbp_map".source = ./layout.xkb;
};
home.keyboard = null;
}

View file

@ -0,0 +1,48 @@
{ config, base16, pkgs, lib, ... }: with lib; {
services.dunst = {
enable = true;
iconTheme = {
inherit (config.gtk.iconTheme) package name;
size = mkDefault "32x32";
};
settings = with base16.map.hash.rgba; {
global = {
transparency = 10;
follow = "mouse";
font = "${config.kw.theme.font.name} 9";
width = "(0, 720)"; # min, max
idle_threshold = 60 * 3;
show_age_threshold = 60;
icon_position = "right";
mouse_right_click = "do_action";
mouse_middle_click = "context";
mouse_left_click = "close_current";
show_indicators = false;
#dmenu = "${config.programs.dmenu.package}/bin/dmenu";
dmenu = "${config.programs.rofi.package}/bin/rofi";
browser = "${pkgs.xdg-utils}/bin/xdg-open";
};
urgency_low = {
frame_color = background_light;
background = background_selection;
foreground = foreground_alt;
highlight = keyword;
timeout = 10;
};
urgency_normal = {
frame_color = background_light;
background = background;
foreground = foreground;
highlight = keyword;
timeout = 30;
};
urgency_critical = {
frame_color = link; # or url
background = background_light;
foreground = foreground;
highlight = keyword;
timeout = 60;
};
};
};
}

View file

@ -3,316 +3,13 @@
{
services.i3gopher = { enable = true; };
kw.theme.swaylock = false;
services.polybar = {
enable = true;
script = let
xrandr = filter: "${pkgs.xorg.xrandr}/bin/xrandr -q | ${pkgs.gnugrep}/bin/grep -F ' ${filter}' | ${pkgs.coreutils}/bin/cut -d' ' -f1";
in mkIf config.xsession.enable ''
primary=$(${xrandr "connected primary"})
for display in $(${xrandr "connected"}); do
export POLYBAR_MONITOR=$display
export POLYBAR_MONITOR_PRIMARY=$([[ $primary = $display ]] && echo true || echo false)
export POLYBAR_TRAY_POSITION=$([[ $primary = $display ]] && echo right || echo none)
polybar arc &
done
'';
package = pkgs.polybarFull;
config = {
"bar/base" = {
modules-left = mkIf config.xsession.windowManager.i3.enable (
mkBefore [ "i3" ]
);
modules-center = mkMerge [
(mkIf (config.home.nixos.hardware.pulseaudio.enable or false || config.home.nixos.services.pipewire.enable or false) (mkBefore [ "pulseaudio" "mic" ]))
(mkIf config.services.playerctld.enable [ "sep" "mpris" ])
(mkIf (config.programs.ncmpcpp.enable && !config.services.playerctld.enable) [ "sep" "mpd" ])
];
modules-right = mkMerge [
[ "net-enp34s0" ]
(mkOrder 1240 [ "sep" ])
(mkOrder 1250 [ "cpu" "temp" "ram" ])
(mkOrder 1490 [ "sep" ])
(mkAfter [ "utc" "date" ])
];
};
};
settings = let
colours = base16.map.hash.argb;
warn-colour = colours.constant; # or deleted
in with colours; {
"bar/arc" = {
"inherit" = "bar/base";
monitor = {
text = mkIf config.xsession.enable "\${env:POLYBAR_MONITOR:}";
};
height = 20;
enable-ipc = true;
tray = {
maxsize = 12;
position = "\${env:POLYBAR_TRAY_POSITION:right}";
};
dpi = {
x = 0;
y = 0;
};
scroll = {
up = "#i3.prev";
down = "#i3.next";
};
font = [
"${config.kw.theme.font.name}:size=9"
"Font Awesome 5 Free Solid:size=9"
"Font Awesome 5 Free Brands:size=9"
];
padding = {
right = 1;
};
separator = {
text = " ";
foreground = foreground_status;
};
background = background_status;
foreground = foreground_alt;
border = {
bottom = {
size = 1;
color = background_light;
};
};
module-margin = 0;
#click-right = ""; menu of some sort?
};
"module/i3" = mkIf config.xsession.windowManager.i3.enable {
type = "internal/i3";
pin-workspaces = true;
strip-wsnumbers = true;
wrapping-scroll = false;
enable-scroll = false; # handled by bar instead
label = {
mode = {
padding = 2;
foreground = constant;
background = background_selection;
};
focused = {
text = "%name%";
padding = 1;
foreground = background_alt;
background = regex;
};
unfocused = {
text = "%name%";
padding = 1;
foreground = foreground_alt;
background = background_light;
};
/*visible = {
text = "%name%";
padding = 1;
foreground = foreground;
#background = background;
};
urgent = {
text = "%name%";
padding = 1;
foreground = foreground_status;
background = link;
};*/
};
};
"module/sep" = {
type = "custom/text";
content = {
text = "|";
foreground = comment;
};
};
"module/ram" = {
type = "internal/memory";
interval = 4;
label = "%gb_used% %percentage_used%% ~ %gb_free%";
warn-percentage = 90;
format.warn.foreground = warn-colour;
};
"module/cpu" = {
type = "internal/cpu";
label = "🖥 %percentage%%"; # 🧮
interval = 2;
warn-percentage = 90;
format.warn.foreground = warn-colour;
};
"module/mpd" = let
ncmpcpp = config.programs.ncmpcpp;
in mkIf ncmpcpp.enable {
type = "internal/mpd";
host = mkIf (ncmpcpp.mpdHost != null) ncmpcpp.mpdHost;
password = mkIf (ncmpcpp.mpdPassword != null) ncmpcpp.mpdPassword;
port = mkIf (ncmpcpp.mpdPort != null) ncmpcpp.mpdPort;
interval = 1;
label-song = " %artist% - %title%";
format = {
online = "<label-time> <label-song>";
playing = "\${self.format-online}";
};
};
"module/net-enp34s0" = {
type = "internal/network";
interface = "enp34s0";
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
use-ui-max = false;
interval = 5;
format.volume = "<ramp-volume> <label-volume>";
ramp.volume = [ "🔈" "🔉" "🔊" ];
label = {
muted = {
text = "🔇 muted";
foreground = warn-colour;
};
};
};
"module/date" = {
type = "internal/date";
label = "%date%, %time%";
format = "<label>";
interval = 60;
date = "%F";
time = "%T";
};
"module/utc" = {
type = "custom/script";
exec = "${pkgs.coreutils}/bin/date -u +%H:%M";
format = "🕓 <label>Z";
interval = 60;
};
"module/temp" = {
type = "internal/temperature";
interval = mkDefault 5;
base-temperature = mkDefault 30;
label = {
text = "%temperature-c%";
warn.foreground = warn-colour;
};
# $ for i in /sys/class/thermal/thermal_zone*; do echo "$i: $(<$i/type)"; done
#thermal-zone = 0;
# Full path of temperature sysfs path
# Use `sensors` to find preferred temperature source, then run
# $ for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done
# Default reverts to thermal zone setting
#hwmon-path = ?
};
"module/net-wlan" = {
type = "internal/network";
interface = mkIf (! config.home.nixos.networking.wireless.iwd.enable or false) (mkDefault "wlan");
label = {
connected = {
text = "📶 %essid% %downspeed:9%";
foreground = inserted;
};
disconnected = {
text = "Disconnected.";
foreground = warn-colour;
};
};
format-packetloss = "<animation-packetloss> <label-connected>";
animation-packetloss = [
{
text = "!"; # ⚠
foreground = warn-colour;
}
{
text = "📶";
foreground = warn-colour;
}
];
};
"module/net-wired" = {
type = "internal/network";
label = {
connected = {
text = "%ifname% %local_ip%";
foreground = inserted;
};
disconnected = {
text = "Unconnected.";
foreground = warn-colour; # or deleted
};
};
# TODO: formatting
};
"module/fs-prefix" = {
type = "custom/text";
content = {
text = "💽";
};
};
"module/fs-root" = {
type = "internal/fs";
mount = mkBefore [ "/" ];
label-mounted = "%mountpoint% %free% %percentage_used%%";
label-warn = "%mountpoint% %{F${warn-colour}}%free% %percentage_used%%%{F-}";
label-unmounted = "";
warn-percentage = 90;
spacing = 1;
};
"module/mic" = {
type = "custom/ipc";
format = "🎤 <output>";
initial = 1;
click.left = "${config.home.nixos.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle && ${config.services.polybar.package}/bin/polybar-msg hook mic 1";
# check if pa default-source is muted, if so, show warning!
# also we trigger an immediate refresh when hitting the keybind
hook = let
pamixer = "${pkgs.pamixer}/bin/pamixer --default-source";
script = pkgs.writeShellScript "checkmute" ''
set -eu
MUTE=$(${pamixer} --get-mute || true)
if [[ $MUTE = true ]]; then
echo muted
else
echo "$(${pamixer} --get-volume)%"
fi
'';
in singleton "${script}";
};
};
};
services.dunst.enable = true;
services.picom = {
enable = true;
experimentalBackends = mkDefault true;
package = mkDefault pkgs.picom-next;
opacityRule = [
# https://wiki.archlinux.org/index.php/Picom#Tabbed_windows_(shadows_and_transparency)
"100:class_g = 'URxvt' && !_NET_WM_STATE@:32a"
"0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
];
shadowExclude = [
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];
};
home.file.".xinitrc".text = ''
exec ~/.xsession
'';
xsession.enable = true;
xsession.windowManager.i3 =
xsession = {
enable = true;
windowManager.i3 =
let
cfg = config.xsession.windowManager.i3.config;
bindsym = k: v: "bindsym ${k} ${v}";
@ -357,7 +54,7 @@
let
pactl = "${config.home.nixos.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl";
#dmenu = "${pkgs.wofi}/bin/wofi -idbt ${pkgs.kitty}/bin/kitty -s ~/.config/wofi/wofi.css -p '' -W 25%";
dmenu = pkgs.writeShellScriptBin "rofi-wrap" ''${pkgs.rofi}/bin/rofi -combi-modi window,drun,ssh -theme solarized -font 'Iosevka 10' -show combi'';
dmenu = pkgs.writeShellScriptBin "rofi-wrap" ''${pkgs.rofi}/bin/rofi -combi-modi window,drun,ssh -show combi'';
in
{
@ -489,6 +186,20 @@
"${cfg.modifier}+r" = "exec ${dmenu.exec}";
# screenshots - upload
"${cfg.modifier}+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify upload screen";
"${cfg.modifier}+Shift+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify upload area";
"${cfg.modifier}+Mod1+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify upload active";
"${cfg.modifier}+Mod1+Control+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify upload window";
"${cfg.modifier}+Control+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify upload output";
# screenshots - clipboard
"Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify copys screen";
"Shift+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify copys area";
"Mod1+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify copys active";
"Mod1+Control+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify copys window";
"Control+Print" = "exec ${pkgs.sway-scrot}/bin/sway-scrot --notify copys output";
# layout handling
"${cfg.modifier}+b" = "splith";
"${cfg.modifier}+v" = "splitv";
@ -581,4 +292,5 @@
${workspaceBindingsStr}
'';
};
};
}

View file

@ -0,0 +1,2 @@
{ config, ... }: {
}

View file

@ -0,0 +1,19 @@
{ config, pkgs, lib, ... }: with lib; {
services.picom = {
enable = true;
experimentalBackends = mkDefault true;
package = mkDefault pkgs.picom-next;
opacityRule = [
# https://wiki.archlinux.org/index.php/Picom#Tabbed_windows_(shadows_and_transparency)
"100:class_g = 'URxvt' && !_NET_WM_STATE@:32a"
"0:_NET_WM_STATE@[0]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[1]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[2]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[3]:32a *= '_NET_WM_STATE_HIDDEN'"
"0:_NET_WM_STATE@[4]:32a *= '_NET_WM_STATE_HIDDEN'"
];
shadowExclude = [
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];
};
}

View file

@ -0,0 +1,464 @@
{ config, base16, pkgs, lib, ... }: with lib; {
systemd.user.services.polybar.Service.Environment = mkForce [
"PATH=/nix/store/bmh5zjsihnyim0pmhgnnmn4adribvns6-polybar-3.5.7/bin:/run/wrappers/bin"
"NOTMUCH_CONFIG=${config.home.sessionVariables.NOTMUCH_CONFIG}"
];
services.polybar = {
enable = true;
script = let
xrandr = filter: "${pkgs.xorg.xrandr}/bin/xrandr -q | ${pkgs.gnugrep}/bin/grep -F ' ${filter}' | ${pkgs.coreutils}/bin/cut -d' ' -f1";
in mkIf config.xsession.enable ''
primary=$(${xrandr "connected primary"})
for display in $(${xrandr "connected"}); do
export POLYBAR_MONITOR=$display
export POLYBAR_MONITOR_PRIMARY=$([[ $primary = $display ]] && echo true || echo false)
export POLYBAR_TRAY_POSITION=$([[ $primary = $display ]] && echo right || echo none)
polybar kat &
done
'';
package = pkgs.polybarFull;
config = {
"bar/base" = {
modules-left = mkMerge [
(mkIf config.xsession.windowManager.i3.enable (mkBefore [ "i3" ]))
[ "title" ]
];
modules-center = mkMerge [
(mkAfter [ "arc" "hex" "miku" "date" ])
];
modules-right = mkMerge [
(mkOrder 1240 [ "pulseaudio" "headset" "mail" ])
(mkOrder 1250 [ "cpu" "temp" "ram" "net-enp34s0" ])
(mkOrder 1490 [ "gpg" ])
];
};
};
settings = let
colours = base16.map.hash.argb;
warn-colour = colours.constant; # or deleted
in with colours; {
"bar/kat" = {
"inherit" = "bar/base";
monitor = {
text = mkIf config.xsession.enable "\${env:POLYBAR_MONITOR:}";
};
height = 20;
enable-ipc = true;
tray = {
maxsize = 12;
position = "\${env:POLYBAR_TRAY_POSITION:right}";
};
offset = {
x = 0;
y = 0;
};
dpi = {
x = 0;
y = 0;
};
spacing = 0;
scroll = {
up = "#i3.prev";
down = "#i3.next";
};
font = [
"${config.kw.theme.font.name}:size=9;2"
"Font Awesome 5 Free Solid:size=9;2"
"Font Awesome 5 Free Brands:size=9;2"
];
padding = {
left = 1;
right = 1;
};
separator = {
text = " ";
foreground = foreground_status;
};
background = "#b219171c";
foreground = foreground_alt;
border = {
bottom = {
size = 1;
color = background_light;
};
};
module-margin = 0;
#click-right = ""; menu of some sort?
};
"module/i3" = mkIf config.xsession.windowManager.i3.enable {
type = "internal/i3";
pin-workspaces = true;
strip-wsnumbers = true;
wrapping-scroll = false;
enable-scroll = false; # handled by bar instead
label = {
mode = {
padding = 2;
foreground = constant;
background = background_selection;
};
focused = {
text = "%name%";
padding = 2;
foreground = background_alt;
background = regex;
};
unfocused = {
text = "%name%";
padding = 2;
foreground = foreground_alt;
background = background_light;
};
visible = {
text = "%name%";
padding = 2;
foreground = foreground;
#background = background;
};
urgent = {
text = "%name%";
padding = 2;
foreground = foreground_status;
background = link;
};
};
};
"module/title" = {
type = "internal/xwindow";
label = {
text = "%title:0:50:%";
padding = 1;
};
format = {
text = "<label>";
background = background_light;
};
format-prefix = {
text = "";
padding = 1;
background = regex;
};
};
"module/sep" = {
type = "custom/text";
content = {
text = "|";
foreground = comment;
};
};
"module/ram" = {
type = "internal/memory";
interval = 4;
format-prefix = {
padding = 1;
text = "";
background = constant;
};
label = {
text = "%percentage_used%%";
padding = 1;
background = background_light;
};
warn-percentage = 90;
format.warn.foreground = warn-colour;
};
"module/cpu" = {
type = "internal/cpu";
format-prefix = {
background = variable;
padding = 1;
text = "";
};
label = {
text = "%percentage%%";
padding = 1;
background = background_light;
};
interval = 2;
warn-percentage = 90;
format.warn.foreground = warn-colour;
};
"module/mpd" = let
ncmpcpp = config.programs.ncmpcpp;
in mkIf ncmpcpp.enable {
type = "internal/mpd";
host = mkIf (ncmpcpp.mpdHost != null) ncmpcpp.mpdHost;
password = mkIf (ncmpcpp.mpdPassword != null) ncmpcpp.mpdPassword;
port = mkIf (ncmpcpp.mpdPort != null) ncmpcpp.mpdPort;
interval = 1;
label-song = " %artist% - %title%";
format = {
online = "<label-time> <label-song>";
playing = "\${self.format-online}";
};
};
"module/net-enp34s0" = {
type = "internal/network";
interface = "enp34s0";
format = {
connected = "<label-connected>";
disconnected = "<label-disconnected>";
};
label = {
connected = {
text = "";
padding = 1;
background = regex;
};
disconnected = {
text = "";
padding = 1;
background = regex;
};
};
};
"module/pulseaudio" = {
type = "internal/pulseaudio";
use-ui-max = false;
interval = 5;
format-muted-prefix = {
padding = 1;
background = warn-colour;
text = "";
};
format = {
background = background_light;
};
format.volume = {
text = "<ramp-volume><label-volume>";
background = background_light;
};
ramp.volume = [
""
""
""
];
ramp-volume-background = keyword;
ramp-volume-padding = 1;
label = {
volume = {
background = background_light;
padding = 1;
};
muted = {
padding = 1;
text = "muted";
background = background_light;
foreground = warn-colour;
};
};
click-right = "${pkgs.kitty}/bin/kitty pulsemixer";
};
"module/date" = {
type = "internal/date";
label = "%date% %time%";
format = {
text = "<label>";
padding = 1;
background = background_light;
};
interval = 60;
date = "%a, %F";
time = "%T";
};
"module/headset" = {
type = "custom/script";
interval = 60;
exec-if = "${pkgs.headsetcontrol}/bin/headsetcontrol -c";
exec = "${pkgs.headsetcontrol}/bin/headsetcontrol -b | ${pkgs.gnugrep}/bin/grep Battery | ${pkgs.coreutils}/bin/cut -d ' ' -f2";
format-prefix = {
text = "";
padding = 1;
background = string;
};
label.padding = 1;
format = {
background = background_light;
text = "<label>";
};
};
"module/gpg" = {
type = "custom/script";
interval = 60;
exec = let
gpgScript = pkgs.writeShellScriptBin "kat-gpg-status" ''
set -eu
set -o pipefail
if gpg --card-status &> /dev/null; then
user="$(gpg --card-status | grep 'Login data' | awk '{print $NF}')";
status='%{B${string}} %{B-}'
else
status='%{B${variable}} %{B-}'
fi
echo $status
'';
gpgScriptWrapped = pkgs.wrapShellScriptBin "kat-gpg-status" "${gpgScript}/bin/kat-gpg-status" { depsRuntimePath = with pkgs; [ coreutils gnugrep gawk gnupg ]; };
in "${gpgScriptWrapped}/bin/kat-gpg-status";
};
"module/arc" = {
type = "custom/script";
exec = "TZ=America/Vancouver ${pkgs.coreutils}/bin/date +-%H";
format-prefix = {
text = "";
padding = 1;
background = string;
};
label.padding = 1;
format = {
background = background_light;
text = "<label>";
};
interval = 60;
};
"module/hex" = {
type = "custom/script";
exec = "TZ=Europe/Berlin ${pkgs.coreutils}/bin/date ++%H";
format-prefix = {
text = "";
padding = 1;
background = support;
};
label.padding = 1;
format = {
background = background_light;
text = "<label>";
};
interval = 60;
};
"module/miku" = {
type = "custom/script";
exec = "TZ=Pacific/Auckland ${pkgs.coreutils}/bin/date ++%H";
format-prefix = {
text = "";
padding = 1;
background = keyword;
};
label.padding = 1;
format = {
background = background_light;
text = "<label>";
};
interval = 60;
};
"module/mail" = {
type = "custom/script";
exec = "${pkgs.notmuch-arc}/bin/notmuch count tag:flagged OR tag:inbox AND NOT tag:killed";
interval = 60;
label = {
padding = 1;
background = background_light;
};
format-prefix = {
text = "";
background = deprecated;
padding = 1;
};
};
"module/temp" = {
type = "internal/temperature";
ramp = ["" "" ""];
ramp-background = string;
ramp-padding = 1;
ramp-2-background = warn-colour;
interval = mkDefault 5;
base-temperature = mkDefault 30;
format = {
text = "<ramp><label>";
};
label = {
padding = 1;
background = background_light;
text = "%temperature-c%";
warn.foreground = warn-colour;
};
# $ for i in /sys/class/thermal/thermal_zone*; do echo "$i: $(<$i/type)"; done
#thermal-zone = 0;
# Full path of temperature sysfs path
# Use `sensors` to find preferred temperature source, then run
# $ for i in /sys/class/hwmon/hwmon*/temp*_input; do echo "$(<$(dirname $i)/name): $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*})) $(readlink -f $i)"; done
# Default reverts to thermal zone setting
#hwmon-path = ?
};
"module/net-wlan" = {
type = "internal/network";
interface = mkIf (! config.home.nixos.networking.wireless.iwd.enable or false) (mkDefault "wlan");
label = {
connected = {
text = "📶 %essid% %downspeed:9%";
foreground = inserted;
};
disconnected = {
text = "Disconnected.";
foreground = warn-colour;
};
};
format-packetloss = "<animation-packetloss> <label-connected>";
animation-packetloss = [
{
text = "!"; # ⚠
foreground = warn-colour;
}
{
text = "📶";
foreground = warn-colour;
}
];
};
"module/net-wired" = {
type = "internal/network";
label = {
connected = {
text = "%ifname% %local_ip%";
foreground = inserted;
};
disconnected = {
text = "Unconnected.";
foreground = warn-colour; # or deleted
};
};
# TODO: formatting
};
"module/fs-prefix" = {
type = "custom/text";
content = {
text = "💽";
};
};
"module/fs-root" = {
type = "internal/fs";
mount = mkBefore [ "/" ];
label-mounted = "%mountpoint% %free% %percentage_used%%";
label-warn = "%mountpoint% %{F${warn-colour}}%free% %percentage_used%%%{F-}";
label-unmounted = "";
warn-percentage = 90;
spacing = 1;
};
"module/mic" = {
type = "custom/ipc";
format = "🎤 <output>";
initial = 1;
click.left = "${config.home.nixos.hardware.pulseaudio.package or pkgs.pulseaudio}/bin/pactl set-source-mute @DEFAULT_SOURCE@ toggle && ${config.services.polybar.package}/bin/polybar-msg hook mic 1";
# check if pa default-source is muted, if so, show warning!
# also we trigger an immediate refresh when hitting the keybind
hook = let
pamixer = "${pkgs.pamixer}/bin/pamixer --default-source";
script = pkgs.writeShellScript "checkmute" ''
set -eu
MUTE=$(${pamixer} --get-mute || true)
if [[ $MUTE = true ]]; then
echo muted
else
echo "$(${pamixer} --get-volume)%"
fi
'';
in singleton "${script}";
};
};
};
}

View file

@ -0,0 +1,159 @@
{ config, base16, lib, pkgs, ... }: with lib; {
programs.rofi = {
enable = true;
font = "${config.kw.theme.font.name} 9";
theme = let
# Use `mkLiteral` for string-like values that should show without
# quotes, e.g.:
# {
# foo = "abc"; => foo: "abc";
# bar = mkLiteral "abc"; => bar: abc;
# };
inherit (config.lib.formats.rasi) mkLiteral;
base = base16.map (c: "rgba (${toString c.red.byte}, ${toString c.green.byte}, ${toString c.blue.byte}, ${toString (c.alpha.dec * 100)} % )");
baset = base16.map (c: "rgba (${toString c.red.byte}, ${toString c.green.byte}, ${toString c.blue.byte}, 70% )");
in {
"*" = {
red = mkLiteral base.variable;
blue = mkLiteral base.function;
lightfg = mkLiteral base.foreground_alt;
lightbg = mkLiteral base.background_light;
foreground = mkLiteral base.foreground;
background = mkLiteral base.background;
background-color = mkLiteral baset.background;
separatorcolor = mkLiteral "@foreground";
border-color = mkLiteral "@foreground";
selected-normal-foreground = mkLiteral "@lightbg";
selected-normal-background = mkLiteral "@lightfg";
selected-active-foreground = mkLiteral "@background";
selected-active-background = mkLiteral "@blue";
selected-urgent-foreground = mkLiteral "@background";
selected-urgent-background = mkLiteral "@red";
normal-foreground = mkLiteral "@foreground";
normal-background = mkLiteral "@background";
active-foreground = mkLiteral "@blue";
active-background = mkLiteral "@background";
urgent-foreground = mkLiteral "@red";
urgent-background = mkLiteral "@background";
alternate-normal-foreground = mkLiteral "@foreground";
alternate-normal-background = mkLiteral "@lightbg";
alternate-active-foreground = mkLiteral "@blue";
alternate-active-background = mkLiteral "@lightbg";
alternate-urgent-foreground = mkLiteral "@red";
alternate-urgent-background = mkLiteral "@lightbg";
};
window = {
background-color = mkLiteral "@background";
border = mkLiteral "1";
padding = mkLiteral "5";
};
mainbox = {
border = mkLiteral "0";
padding = mkLiteral "0";
};
message = {
border = mkLiteral "1px dash 0px 0px";
border-color = mkLiteral "@separatorcolor";
padding = mkLiteral "1px";
};
textbox = {
text-color = mkLiteral "@foreground";
};
listview = {
fixed-height = mkLiteral "0";
border = mkLiteral "2px dash 0px 0px";
border-color = mkLiteral "@separatorcolor";
spacing = mkLiteral "2px";
scrollbar = mkLiteral "true";
padding = mkLiteral "2px 0px 0px";
};
"element-text, element-icon" = {
background-color = mkLiteral "inherit";
text-color = mkLiteral "inherit";
};
element = {
border = mkLiteral "0";
padding = mkLiteral "1px";
};
"element normal.normal"= {
background-color = mkLiteral "@normal-background";
text-color = mkLiteral "@normal-foreground";
};
"element normal.urgent" = {
background-color = mkLiteral "@urgent-background";
text-color = mkLiteral "@urgent-foreground";
};
"element normal.active" = {
background-color = mkLiteral "@active-background";
text-color = mkLiteral "@active-foreground";
};
"element selected.normal" = {
background-color = mkLiteral "@selected-normal-background";
text-color = mkLiteral "@selected-normal-foreground";
};
"element selected.urgent" = {
background-color = mkLiteral "@selected-urgent-background";
text-color = mkLiteral "@selected-urgent-foreground";
};
"element selected.active" = {
background-color = mkLiteral "@selected-active-background";
text-color = mkLiteral "@selected-active-foreground";
};
"element alternate.normal" = {
background-color = mkLiteral "@alternate-normal-background";
text-color = mkLiteral "@alternate-normal-foreground";
};
"element alternate.urgent" = {
background-color = mkLiteral "@alternate-urgent-background";
text-color = mkLiteral "@alternate-urgent-foreground";
};
"element alternate.active" = {
background-color = mkLiteral "@alternate-active-background";
text-color = mkLiteral "@alternate-active-foreground";
};
scrollbar = {
width = mkLiteral "4px";
border = mkLiteral "0";
handle-color = mkLiteral "@normal-foreground";
handle-width = mkLiteral "8px";
padding = mkLiteral "0";
};
sidebar = {
border = mkLiteral "2px dash 0px 0px";
border-color = mkLiteral "@separatorcolor";
};
button = {
spacing = mkLiteral "0";
text-color = mkLiteral "@normal-foreground";
};
"button selected" = {
background-color = mkLiteral "@selected-normal-background";
text-color = mkLiteral "@selected-normal-foreground";
};
inputbar = {
spacing = mkLiteral "0px";
text-color = mkLiteral "@normal-foreground";
padding = mkLiteral "1px";
children = map mkLiteral [ "prompt" "textbox-prompt-colon" "entry" "case-indicator" ];
};
case-indicator = {
spacing = mkLiteral "0";
text-color = mkLiteral "@normal-foreground";
};
entry = {
spacing = mkLiteral "0";
text-color = mkLiteral "@normal-foreground";
};
prompt = {
spacing = mkLiteral "0";
text-color = mkLiteral "@normal-foreground";
};
textbox-prompt-colon = {
expand = mkLiteral "false";
str = mkLiteral ''":"'';
margin = mkLiteral "0px 0.3000em 0.0000em 0.0000em";
text-color = mkLiteral "inherit";
};
};
};
}

View file

@ -6,6 +6,4 @@
package = pkgs.obs-studio-pipewire;
plugins = [ pkgs.obs-studio-plugins.wlrobs ];
};
programs.zsh.shellAliases = { obs = "env QT_QPA_PLATFORM=xcb obs"; };
}

View file

@ -1,16 +0,0 @@
{ config, nixos, lib, ... }:
with lib;
{
services.konawall = {
enable = true;
interval = "30m";
mode = "shuffle";
commonTags = [ "width:>=1600" ];
tagList = map (toList) [
(["score:>=50"
"touhou" "rating:s"]) #++ optional (nixos.networking.hostName == "koishi") "rating:s")
];
};
}

View file

@ -1,15 +0,0 @@
{ config, ... }:
{
home.file = {
".xkb/symbols/us_gbp_map".text = ''
default partial alphanumeric_keys
xkb_symbols "basic" {
include "us(altgr-intl)"
name[Group1] = "English (US, international with pound sign)";
key <AD03> { [ e, E, EuroSign, cent ] };
key <AE03> { [ 3, numbersign, sterling] };
};
'';
};
}

12
flake.lock generated
View file

@ -297,11 +297,11 @@
"katexprs": {
"flake": false,
"locked": {
"lastModified": 1640111173,
"narHash": "sha256-ZgRM2kb3yDGJCQGZChtPaEwQimllWCc8oYSyyQ2pruA=",
"lastModified": 1641325835,
"narHash": "sha256-q5T6OBQWdc5QrwWJAcoCbpdWHF75EofHrHrdyoXSqhY=",
"owner": "kittywitch",
"repo": "nixexprs",
"rev": "b89aabdc5e9bbb57e4dbbea5a950bf97978be500",
"rev": "a90f47f9cd9dacd1a878189781ad92887d67025f",
"type": "github"
},
"original": {
@ -587,11 +587,11 @@
"tf-nix": {
"flake": false,
"locked": {
"lastModified": 1638394086,
"narHash": "sha256-2Q/Dy0rYNmpIqYrqjkXAI3CbZhuG3I3lhktcE8nFl7U=",
"lastModified": 1639529339,
"narHash": "sha256-r+nIyHAKUZA3bWOlpNpu2ferhXYx4f3TbtMEJpVfbVg=",
"owner": "arcnmx",
"repo": "tf-nix",
"rev": "e79ce0838183f1446282650379d920efcb594777",
"rev": "932837bbc371389ff3597a2e5b4791b45b5e18bd",
"type": "github"
},
"original": {