eh it is not working
This commit is contained in:
parent
777517f8c8
commit
e138a3f9be
11 changed files with 137 additions and 265 deletions
|
|
@ -2,6 +2,5 @@
|
|||
{
|
||||
imports = [
|
||||
./i3.nix
|
||||
./polybar.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,121 +1,47 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
osConfig,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
ccfg = import ../../config.nix;
|
||||
ccfg = import ../../../config.nix;
|
||||
cfg_path = [
|
||||
ccfg.custom_config_key
|
||||
"desktopEnvironment"
|
||||
"i3"
|
||||
];
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path config;
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path osConfig;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.i3 = {
|
||||
enable = true;
|
||||
package = pkgs.i3; # i3 window manager
|
||||
windowManager.command = "i3";
|
||||
extraConfig = lib.mkForce (''
|
||||
# Generated from sway configuration
|
||||
set $mod Mod4
|
||||
set $term ${cfg.terminalCommand}
|
||||
set $menu rofi -show drun
|
||||
xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
config = lib.attrsets.recursiveUpdate {
|
||||
startup = [
|
||||
{ command = "setxkbmap -layout us -option caps:escape"; }
|
||||
];
|
||||
modifier = "Mod4";
|
||||
terminal = cfg.terminalCommand;
|
||||
keybindings =
|
||||
let
|
||||
mod = config.xsession.windowManager.i3.config.modifier;
|
||||
in
|
||||
{
|
||||
# Focus
|
||||
"${mod}+h" = "focus left";
|
||||
"${mod}+l" = "focus right";
|
||||
"${mod}+k" = "focus up";
|
||||
"${mod}+j" = "focus down";
|
||||
# Apps
|
||||
"${mod}+Return" = "exec ${cfg.terminalCommand}";
|
||||
# "${mod}+space" = "exec ${cfg.menu}"; TODO
|
||||
"${mod}+q" = "kill";
|
||||
"${mod}+Shift+Escape" = "exit";
|
||||
"${mod}+Shift+q" = "exec i3lock";
|
||||
"${mod}+f" = "floating toggle";
|
||||
|
||||
# Input
|
||||
# Caps lock as escape is handled system-wide in NixOS
|
||||
|
||||
# Focus
|
||||
bindsym $mod+h focus left
|
||||
bindsym $mod+l focus right
|
||||
bindsym $mod+k focus up
|
||||
bindsym $mod+j focus down
|
||||
|
||||
# Apps
|
||||
bindsym $mod+Return exec $term
|
||||
bindsym $mod+space exec ${cfg.menu}
|
||||
bindsym $mod+q kill
|
||||
bindsym $mod+Shift+Escape exit
|
||||
bindsym $mod+Shift+q exec i3lock
|
||||
bindsym $mod+f floating toggle
|
||||
|
||||
# Workspaces
|
||||
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"
|
||||
|
||||
bindsym $mod+1 workspace $ws1
|
||||
bindsym $mod+n workspace $ws1
|
||||
bindsym $mod+2 workspace $ws2
|
||||
bindsym $mod+m workspace $ws2
|
||||
bindsym $mod+3 workspace $ws3
|
||||
bindsym $mod+comma workspace $ws3
|
||||
bindsym $mod+4 workspace $ws4
|
||||
bindsym $mod+period workspace $ws4
|
||||
bindsym $mod+5 workspace $ws5
|
||||
bindsym $mod+slash workspace $ws5
|
||||
bindsym $mod+6 workspace $ws6
|
||||
bindsym $mod+7 workspace $ws7
|
||||
bindsym $mod+8 workspace $ws8
|
||||
bindsym $mod+9 workspace $ws9
|
||||
bindsym $mod+0 workspace $ws10
|
||||
|
||||
# Move windows
|
||||
bindsym $mod+Shift+h move left
|
||||
bindsym $mod+Shift+l move right
|
||||
bindsym $mod+Shift+k move up
|
||||
bindsym $mod+Shift+j move down
|
||||
bindsym $mod+Shift+1 move container to workspace $ws1
|
||||
bindsym $mod+Shift+n move container to workspace $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace $ws2
|
||||
bindsym $mod+Shift+m move container to workspace $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace $ws3
|
||||
bindsym $mod+Shift+comma move container to workspace $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace $ws4
|
||||
bindsym $mod+Shift+period move container to workspace $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace $ws5
|
||||
bindsym $mod+Shift+slash move container to workspace $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace $ws10
|
||||
|
||||
# Mouse
|
||||
floating_modifier $mod
|
||||
|
||||
# Screenshot (uses grim/slurp on Wayland; on X11 use maim)
|
||||
bindsym Print exec --no-startup-id maim -s | xclip -selection clipboard -t image/png
|
||||
|
||||
# Startup
|
||||
exec --no-startup-id ${pkgs.bash}/bin/sh -c '~/.config/polybar/launch.sh'
|
||||
|
||||
# gaps, borders handled by i3-gaps if available
|
||||
include ~/.config/i3/custom.conf
|
||||
'') ;
|
||||
};
|
||||
|
||||
home.file = {
|
||||
".config/i3/config" = {
|
||||
text = builtins.toString (config.programs.i3.extraConfig);
|
||||
};
|
||||
".config/i3/custom.conf" = {
|
||||
text = let
|
||||
extra = cfg.extraOptions or {};
|
||||
mkWorkspaceAssign = ws: out: "workspace \"${ws}\" output ${out}\n";
|
||||
wsAssigns = if extra.workspaceOutputAssign == null then "" else
|
||||
lib.concatStringsSep "" (lib.map (v: mkWorkspaceAssign v.workspace v.output) extra.workspaceOutputAssign);
|
||||
startupLines = if extra.startup == null then "" else
|
||||
lib.concatStringsSep "" (lib.map (s: "exec --no-startup-id ${s.command}\n") extra.startup);
|
||||
in wsAssigns + startupLines;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [ i3 i3status polybar maim xclip i3lock i3-gaps ];
|
||||
};
|
||||
# See home-manager documentation for everything you can add here.
|
||||
} cfg.extraOptions;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
ccfg = import ../../config.nix;
|
||||
cfg_path = [
|
||||
ccfg.custom_config_key
|
||||
"desktopEnvironment"
|
||||
"i3"
|
||||
"polybar"
|
||||
];
|
||||
cfg = lib.attrsets.getAttrFromPath cfg_path config;
|
||||
in
|
||||
{
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.file = {
|
||||
".config/polybar/config" = {
|
||||
text = builtins.readFile ./polybar/config;
|
||||
};
|
||||
".config/polybar/launch.sh" = {
|
||||
text = builtins.readFile ./polybar/launch.sh;
|
||||
executable = true;
|
||||
};
|
||||
};
|
||||
|
||||
home.packages = [ pkgs.polybar ];
|
||||
services.xserver.windowManager.i3.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
[bar/top]
|
||||
width = 100%
|
||||
height = 28
|
||||
background = #1a1b26
|
||||
foreground = #c0caf5
|
||||
modules-left = workspace
|
||||
modules-center = date cpu memory
|
||||
modules-right = pulseaudio battery network
|
||||
|
||||
environment = {
|
||||
TERM = xterm-256color
|
||||
}
|
||||
|
||||
[module/workspace]
|
||||
type = internal/xworkspaces
|
||||
pin-workspaces = true
|
||||
wrap-scroll = false
|
||||
; icons for numbers
|
||||
format-underline = #7dcae4
|
||||
label = %name%
|
||||
label-foreground = #c0caf5
|
||||
|
||||
[module/date]
|
||||
type = internal/date
|
||||
interval = 5
|
||||
format = %b %d, %H:%M
|
||||
|
||||
[module/cpu]
|
||||
type = internal/cpu
|
||||
format = %percentage:2.0%%
|
||||
|
||||
[module/memory]
|
||||
type = internal/memory
|
||||
format = %used_percent%%
|
||||
|
||||
[module/pulseaudio]
|
||||
type = internal/pulseaudio
|
||||
format = {volume}%
|
||||
|
||||
[module/battery]
|
||||
type = internal/battery
|
||||
battery = BAT0
|
||||
adapter = AC
|
||||
format-charging = %percentage%%
|
||||
format-discharging = %percentage%%
|
||||
|
||||
[module/network]
|
||||
type = internal/network
|
||||
interface = auto
|
||||
format-connected = %essid% (%signal_strength%%)
|
||||
format-disconnected = Disconnected
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# Launch polybar on each connected monitor
|
||||
MONITORS=$(xrandr --query | grep " connected" | cut -d' ' -f1)
|
||||
for m in $MONITORS; do
|
||||
MONITOR=$m polybar --reload top &
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue