nix #11
|
@ -60,39 +60,6 @@
|
||||||
- color
|
- color
|
||||||
- i3
|
- i3
|
||||||
|
|
||||||
- name: Download base16 theme for Tridactyl
|
|
||||||
ansible.builtin.copy:
|
|
||||||
content: "{{ base16_schemes['schemes'][base16_scheme]['tridactyl']['base16-' + base16_scheme + '.config.py'] }}"
|
|
||||||
# url: "https://raw.githubusercontent.com/bezmi/base16-tridactyl/master/base16-{{ base16_scheme }}.css"
|
|
||||||
dest: "{{ ansible_env.HOME }}/.config/tridactyl/themes/theme.css"
|
|
||||||
mode: u=rw,g=r,o=r
|
|
||||||
when: false # Not currently used
|
|
||||||
tags:
|
|
||||||
- color
|
|
||||||
|
|
||||||
- name: Configure i3
|
|
||||||
ansible.builtin.template:
|
|
||||||
src: "{{ ansible_env.HOME }}/.config/i3/config.j2"
|
|
||||||
dest: "{{ ansible_env.HOME }}/.config/i3/config"
|
|
||||||
mode: u=rw,g=r,o=r
|
|
||||||
notify:
|
|
||||||
- i3-reload
|
|
||||||
tags:
|
|
||||||
- color
|
|
||||||
- i3
|
|
||||||
when: display_server == 'x11'
|
|
||||||
|
|
||||||
- name: Set base16 theme for rofi
|
|
||||||
ansible.builtin.copy:
|
|
||||||
content: "{{ base16_schemes['schemes'][base16_scheme]['rofi']['themes']['base16-' + base16_scheme + '.' + item] }}"
|
|
||||||
dest: "{{ ansible_env.HOME }}/.config/rofi/theme.{{ item }}"
|
|
||||||
mode: u=rw,g=r,o=r
|
|
||||||
tags:
|
|
||||||
- color
|
|
||||||
loop:
|
|
||||||
- config
|
|
||||||
- rasi
|
|
||||||
|
|
||||||
- name: Configure Dunst
|
- name: Configure Dunst
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
|
src: "{{ ansible_env.HOME }}/.config/dunst/dunstrc.j2"
|
||||||
|
|
2
config/i3/.gitignore
vendored
2
config/i3/.gitignore
vendored
|
@ -1,2 +0,0 @@
|
||||||
config
|
|
||||||
theme
|
|
|
@ -1,90 +0,0 @@
|
||||||
# vi:syntax=conf
|
|
||||||
# i3 config file (v4)
|
|
||||||
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
|
|
||||||
|
|
||||||
# Set mod key (Mod1=<Alt>, Mod4=<Super>)
|
|
||||||
set $mod Mod4
|
|
||||||
|
|
||||||
# set default desktop layout (default is tiling)
|
|
||||||
# workspace_layout tabbed <stacking|tabbed>
|
|
||||||
|
|
||||||
# Configure border style <normal|1pixel|pixel xx|none|pixel>
|
|
||||||
new_window pixel 2
|
|
||||||
new_float normal
|
|
||||||
|
|
||||||
# Hide borders
|
|
||||||
hide_edge_borders both
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mouse_warping output
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Workspace names
|
|
||||||
set $WS1 1
|
|
||||||
set $WS2 2
|
|
||||||
set $WS3 3
|
|
||||||
set $WS4 4
|
|
||||||
set $WS5 5
|
|
||||||
set $WS6 6
|
|
||||||
set $WS7 7
|
|
||||||
set $WS8 8
|
|
||||||
set $WS9 9
|
|
||||||
set $WS10 10
|
|
||||||
|
|
||||||
# Workspace output
|
|
||||||
{% set screens = x11_screens | default(['DEFAULT']) %}
|
|
||||||
{% for i in range(1, 11) %}
|
|
||||||
workspace "$WS{{ i }}" output {{ screens[(i - 1) % (screens | length)] }}
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Default layout = tabs, since I mostly exclusively use them
|
|
||||||
workspace_layout tabbed
|
|
||||||
|
|
||||||
# Open specific applications in floating mode
|
|
||||||
for_window [title="pacmixer"] floating enable border pixel 2
|
|
||||||
for_window [class="Firefox"] layout tabbed # Doesn't seem to work anymore
|
|
||||||
for_window [class="qutebrowser"] layout tabbed
|
|
||||||
|
|
||||||
for_window [window_role="pop-up"] floating enable
|
|
||||||
for_window [window_role="task_dialog"] floating enable
|
|
||||||
for_window [ title="^pdfpc.*" window_role="presenter" ] move to output left, fullscreen
|
|
||||||
for_window [ title="^pdfpc.*" window_role="presentation" ] move to output right, fullscreen
|
|
||||||
|
|
||||||
# switch to workspace with urgent window automatically
|
|
||||||
for_window [urgent=latest] focus
|
|
||||||
|
|
||||||
# Set shut down, restart and locking features
|
|
||||||
set $locker $HOME/.config/i3/lock
|
|
||||||
|
|
||||||
# Inactivity settings
|
|
||||||
exec --no-startup-id xautolock -time 10 -locker 'xset dpms force standby' -killtime 1 -killer '$locker'
|
|
||||||
"$mod+F1" = "exec --no-startup-id sh -c "sleep .25 && xset dpms force off"";
|
|
||||||
"$mod+F4" = "exec --no-startup-id xautolock -disable";
|
|
||||||
"$mod+F5" = "exec --no-startup-id xautolock -enable";
|
|
||||||
|
|
||||||
|
|
||||||
# Autostart applications
|
|
||||||
#exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 # Password remembering
|
|
||||||
#exec --no-startup-id gnome-keyring-daemon # Password remembering
|
|
||||||
# exec --no-startup-id urxvtd -q -f # urxvt daemon
|
|
||||||
{% if auto_numlock %}
|
|
||||||
exec --no-startup-id numlockx on # Activate Num lock
|
|
||||||
{% endif %}
|
|
||||||
exec --no-startup-id unclutter -root # Hide mouse cursor after some time
|
|
||||||
#exec --no-startup-id dunst # Notifications (handled by systemd)
|
|
||||||
exec --no-startup-id keynav # Keyboard cursor controller
|
|
||||||
#exec --no-startup-id mpd # Music Player Daemon (handled by systemd)
|
|
||||||
exec --no-startup-id autorandr --change --force # Screen configuration and everything that depends on it
|
|
||||||
{% if has_battery %}
|
|
||||||
exec --no-startup-id ~/.config/i3/batteryNotify -d # Battery state notification
|
|
||||||
{% endif %}
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
BATT="/sys/class/power_supply/BAT0"
|
BATT="/sys/class/power_supply/BAT0"
|
||||||
LOW=10
|
LOW=10
|
||||||
CRIT=3
|
CRIT=3
|
||||||
|
@ -25,10 +23,10 @@ function computeState() {
|
||||||
|
|
||||||
if [ "$acpiStatus" == "Discharging" ]
|
if [ "$acpiStatus" == "Discharging" ]
|
||||||
then
|
then
|
||||||
if [ $acpiCapacity -le $CRIT ]
|
if [ "$acpiCapacity" -le $CRIT ]
|
||||||
then
|
then
|
||||||
setState "CRIT" -u critical -i battery-caution "Battery level is critical" "$acpiCapacity %"
|
setState "CRIT" -u critical -i battery-caution "Battery level is critical" "$acpiCapacity %"
|
||||||
elif [ $acpiCapacity -le $LOW ]
|
elif [ "$acpiCapacity" -le $LOW ]
|
||||||
then
|
then
|
||||||
setState "LOW" -u critical -i battery-low "Battery level is low" "$acpiCapacity %"
|
setState "LOW" -u critical -i battery-low "Battery level is low" "$acpiCapacity %"
|
||||||
else
|
else
|
|
@ -9,32 +9,31 @@
|
||||||
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old
|
lockColors = { a = "#82a401"; b = "#466c01"; d = "#648901"; }; # Old
|
||||||
lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.d}\"/></svg>";
|
lockSvg = pkgs.writeText "lock.svg" "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 50 50\" height=\"50\" width=\"50\"><path fill=\"${lockColors.a}\" d=\"M0 50h50V0H0z\"/><path d=\"M0 0l50 50H25L0 25zm50 0v25L25 0z\" fill=\"${lockColors.d}\"/></svg>";
|
||||||
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
|
lockPng = pkgs.runCommand "lock.png" { } "${pkgs.imagemagick}/bin/convert ${lockSvg} $out";
|
||||||
locker = "exec ${ pkgs.writeShellScript "i3-locker"
|
locker = pkgs.writeShellScript "i3-locker"
|
||||||
''
|
''
|
||||||
# Remove SSH and GPG keys from keystores
|
# Remove SSH and GPG keys from keystores
|
||||||
${pkgs.openssh}/bin/ssh-add -D
|
${pkgs.openssh}/bin/ssh-add -D
|
||||||
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
|
echo RELOADAGENT | ${pkgs.gnupg}/bin/gpg-connect-agent
|
||||||
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
|
${pkgs.coreutils}/bin/rm -rf "/tmp/cached_pass_$UID"
|
||||||
|
|
||||||
${pkgs.lightdm}/bin/dm-tool lock
|
${pkgs.lightdm}/bin/dm-tool lock
|
||||||
# TODO Does that work for all DMs?
|
# TODO Does that work for all DMs?
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
if [ -d ${config.xdg.cacheHome}/lockpatterns ]
|
if [ -d ${config.xdg.cacheHome}/lockpatterns ]
|
||||||
then
|
then
|
||||||
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1)
|
pattern=$(${pkgs.findutils} ${config.xdg.cacheHome}/lockpatterns | sort -R | head -1)
|
||||||
else
|
else
|
||||||
pattern=${lockPng}
|
pattern=${lockPng}
|
||||||
fi
|
fi
|
||||||
revert() {
|
revert() {
|
||||||
${pkgs.xorg.xset} dpms 0 0 0
|
${pkgs.xorg.xset}/bin/xset dpms 0 0 0
|
||||||
}
|
}
|
||||||
trap revert SIGHUP SIGINT SIGTERM
|
trap revert SIGHUP SIGINT SIGTERM
|
||||||
${pkgs.xorg.xset} dpms 5 5 5
|
${pkgs.xorg.xset}/bin/xset dpms 5 5 5
|
||||||
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
|
${pkgs.i3lock}/bin/i3lock --nofork --color ${builtins.substring 1 6 lockColors.d} --image=$pattern --tiling --ignore-empty-password
|
||||||
revert
|
revert
|
||||||
fi
|
fi
|
||||||
''
|
'';
|
||||||
}";
|
|
||||||
focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
|
focus = "exec ${ pkgs.writeShellScript "i3-focus-window"
|
||||||
''
|
''
|
||||||
WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
|
WINDOW=`${pkgs.xdotool}/bin/xdotool getwindowfocus`
|
||||||
|
@ -52,6 +51,7 @@
|
||||||
mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
|
mode_temp = "Temperature [R] Red [D] Dust storm [C] Campfire [O] Normal [A] All nighter [B] Blue";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
modifier = "Mod1"; # FIXME Mod1 for VM, Mod4 for not VM
|
||||||
terminal = "alacritty";
|
terminal = "alacritty";
|
||||||
# bars = []; # FIXME lemonbar
|
# bars = []; # FIXME lemonbar
|
||||||
colors = let ignore = "#ff00ff"; in
|
colors = let ignore = "#ff00ff"; in
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
# Compatibility layer for people coming from other backgrounds
|
# Compatibility layer for people coming from other backgrounds
|
||||||
# "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM
|
# "Mod1+Tab" = "${rofi} -modi window -show window"; # FIXME When no longer using a VM
|
||||||
"Mod1+F2" = "${rofi} -modi drun -show drun";
|
"Mod1+F2" = "${rofi} -modi drun -show drun";
|
||||||
"Mod1+F4" = "kill";
|
# "Mod1+F4" = "kill"; # FIXME When no longer using a VM
|
||||||
# kill focused window
|
# kill focused window
|
||||||
"${mod}+z" = "kill";
|
"${mod}+z" = "kill";
|
||||||
button2 = "kill";
|
button2 = "kill";
|
||||||
|
@ -163,6 +163,7 @@
|
||||||
"${mod}+8" = "workspace 8; ${focus}";
|
"${mod}+8" = "workspace 8; ${focus}";
|
||||||
"${mod}+9" = "workspace 9; ${focus}";
|
"${mod}+9" = "workspace 9; ${focus}";
|
||||||
"${mod}+0" = "workspace 10; ${focus}";
|
"${mod}+0" = "workspace 10; ${focus}";
|
||||||
|
# TODO Prevent repetitions, see workspace assignation for example
|
||||||
#navigate workspaces next / previous
|
#navigate workspaces next / previous
|
||||||
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
|
"${mod}+Ctrl+h" = "workspace prev_on_output; ${focus}";
|
||||||
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
|
"${mod}+Ctrl+l" = "workspace next_on_output; ${focus}";
|
||||||
|
@ -204,6 +205,11 @@
|
||||||
"${mod}+Shift+c" = "reload";
|
"${mod}+Shift+c" = "reload";
|
||||||
"${mod}+Shift+r" = "restart";
|
"${mod}+Shift+r" = "restart";
|
||||||
"${mod}+Shift+e" = "exit";
|
"${mod}+Shift+e" = "exit";
|
||||||
|
# Screen off commands
|
||||||
|
"${mod}+F1" = "exec --no-startup-id ${pkgs.bash}/bin/sh -c \"${pkgs.coreutils}/bin/sleep .25 && ${pkgs.xorg.xset}/bin/xset dpms force off\"";
|
||||||
|
# TODO --release?
|
||||||
|
"${mod}+F4" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -disable";
|
||||||
|
"${mod}+F5" = "exec --no-startup-id ${pkgs.xautolock}/bin/xautolock -enable";
|
||||||
# Modes
|
# Modes
|
||||||
"${mod}+Escape" = "mode ${mode_system}";
|
"${mod}+Escape" = "mode ${mode_system}";
|
||||||
"${mod}+r" = "mode ${mode_resize}";
|
"${mod}+r" = "mode ${mode_resize}";
|
||||||
|
@ -217,10 +223,10 @@
|
||||||
}; in
|
}; in
|
||||||
{
|
{
|
||||||
"${mode_system}" = {
|
"${mode_system}" = {
|
||||||
"l" = "exec --no-startup-id ${locker}, mode default";
|
"l" = "exec --no-startup-id exec ${locker}, mode default";
|
||||||
"e" = "exit, mode default";
|
"e" = "exit, mode default";
|
||||||
"s" = "exec --no-startup-id ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default";
|
"s" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl suspend, mode default";
|
||||||
"h" = "exec --no-startup-id ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
|
"h" = "exec --no-startup-id exec ${locker} & ${pkgs.systemd}/bin/systemctl hibernate, mode default";
|
||||||
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
|
"r" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl reboot, mode default";
|
||||||
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
|
"p" = "exec --no-startup-id ${pkgs.systemd}/bin/systemctl poweroff -i, mode default";
|
||||||
} // return_bindings;
|
} // return_bindings;
|
||||||
|
@ -268,8 +274,53 @@
|
||||||
"b" = "exec ${pkgs.sct}/bin/sct 10000";
|
"b" = "exec ${pkgs.sct}/bin/sct 10000";
|
||||||
} // return_bindings;
|
} // return_bindings;
|
||||||
};
|
};
|
||||||
|
window = {
|
||||||
|
hideEdgeBorders = "both";
|
||||||
|
titlebar = false; # So that single-container screens are basically almost fullscreen
|
||||||
|
commands = [
|
||||||
|
# Open specific applications in floating mode
|
||||||
|
{ criteria = { class = "Firefox"; }; command = "layout tabbed"; } # Doesn't seem to work anymore
|
||||||
|
{ criteria = { class = "qutebrowser"; }; command = "layout tabbed"; }
|
||||||
|
{ criteria = { title = "^pdfpc.*"; window_role = "presenter"; }; command = "move to output left, fullscreen"; }
|
||||||
|
{ criteria = { title = "^pdfpc.*"; window_role = "presentation"; }; command = "move to output right, fullscreen"; }
|
||||||
|
# switch to workspace with urgent window automatically
|
||||||
|
{ criteria = { urgent = "latest"; }; command = "focus"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
floating = {
|
||||||
|
criteria = [
|
||||||
|
{ title = "pacmixer"; }
|
||||||
|
{ window_role = "pop-up"; }
|
||||||
|
{ window_role = "task_dialog"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
startup = [
|
||||||
|
# Lock screen after 10 minutes
|
||||||
|
{ notification = false; command = "${pkgs.xautolock}/bin/xautolock -time 10 -locker '${pkgs.xorg.xset}/bin/xset dpms force standby' -killtime 1 -killer ${locker}"; }
|
||||||
|
{
|
||||||
|
notification = false;
|
||||||
|
command = "${pkgs.writeShellApplication {
|
||||||
|
name = "batteryNotify";
|
||||||
|
runtimeInputs = with pkgs; [coreutils libnotify];
|
||||||
|
text = builtins.readFile ./batteryNotify.sh;
|
||||||
|
# TODO Use batsignal instead?
|
||||||
|
# TODO Only on computers with battery
|
||||||
|
}}/bin/batteryNotify";
|
||||||
|
}
|
||||||
|
# TODO There's a services.screen-locker.xautolock but not sure it can match the above command
|
||||||
|
];
|
||||||
|
workspaceLayout = "tabbed";
|
||||||
|
focus.mouseWarping = true; # i3 only supports warping to workspace, hence ${focus}
|
||||||
|
workspaceOutputAssign =
|
||||||
|
let
|
||||||
|
x11_screens = [ "HDMI-1-0" "eDP1" ]; # FIXME Per computer thing
|
||||||
|
workspaces = map (i: { name = toString i; key = toString (lib.mod i 10); }) (lib.lists.range 1 10);
|
||||||
|
forEachWorkspace = f: map (w: f { w = w; workspace = ((builtins.elemAt workspaces w)); }) (lib.lists.range 0 ((builtins.length workspaces) - 1));
|
||||||
|
in
|
||||||
|
forEachWorkspace ({ w, workspace }: { output = builtins.elemAt x11_screens (lib.mod w (builtins.length x11_screens)); workspace = workspace.name; });
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
xsession.numlock.enable = true; # FIXME Only on computers with a separate one
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
# Browser
|
# Browser
|
||||||
|
@ -323,6 +374,15 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
pass.enable = true;
|
pass.enable = true;
|
||||||
};
|
};
|
||||||
|
autorandr.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
xdg.userDirs.enable = true; # TODO Which ones do we want?
|
||||||
|
services = {
|
||||||
|
unclutter.enable = true;
|
||||||
|
dunst.enable = true;
|
||||||
|
mpd.enable = true;
|
||||||
|
autorandr.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
@ -330,7 +390,6 @@
|
||||||
tigervnc
|
tigervnc
|
||||||
|
|
||||||
# music
|
# music
|
||||||
mpd
|
|
||||||
mpc-cli
|
mpc-cli
|
||||||
ashuffle
|
ashuffle
|
||||||
vimpc
|
vimpc
|
||||||
|
@ -361,13 +420,10 @@
|
||||||
yubikey-touch-detector
|
yubikey-touch-detector
|
||||||
|
|
||||||
# x11-exclusive
|
# x11-exclusive
|
||||||
dunst
|
|
||||||
numlockx
|
numlockx
|
||||||
# TODO urxvt-resize-font-git
|
# TODO urxvt-resize-font-git
|
||||||
simplescreenrecorder
|
simplescreenrecorder
|
||||||
trayer
|
trayer
|
||||||
unclutter
|
|
||||||
xautolock
|
|
||||||
xclip
|
xclip
|
||||||
lemonbar-xft
|
lemonbar-xft
|
||||||
keynav
|
keynav
|
||||||
|
|
Loading…
Reference in a new issue