From ee3415e2b907e464b730f6921e56c4e00d54fd1a Mon Sep 17 00:00:00 2001 From: Yorick van Pelt Date: Sat, 17 Sep 2016 15:09:53 +0200 Subject: [PATCH] switch to i3 with some nix to build it --- bin/default.nix | 20 ++++ bin/vga_setup.sh | 1 - default.nix | 12 +++ gtk/.config/gtk-3.0/settings.ini | 3 + gtk/.gtkrc-2.0 | 2 + i3/.config/i3/config | 1 + i3/.config/i3status/config | 63 +++++++++++ i3/.stow-local-ignore | 1 + i3/i3.nix | 180 +++++++++++++++++++++++++++++++ install.sh | 3 +- nix/.nixpkgs/config.nix | 25 +++-- x/.Xdefaults | 71 ++++++++++++ x/.stow-local-ignore | 1 + x/compton.conf | 19 ++++ 14 files changed, 394 insertions(+), 8 deletions(-) create mode 100644 bin/default.nix create mode 100644 default.nix create mode 100644 gtk/.config/gtk-3.0/settings.ini create mode 100644 gtk/.gtkrc-2.0 create mode 120000 i3/.config/i3/config create mode 100644 i3/.config/i3status/config create mode 100644 i3/.stow-local-ignore create mode 100644 i3/i3.nix create mode 100644 x/.Xdefaults create mode 100644 x/.stow-local-ignore create mode 100644 x/compton.conf diff --git a/bin/default.nix b/bin/default.nix new file mode 100644 index 0000000..8503348 --- /dev/null +++ b/bin/default.nix @@ -0,0 +1,20 @@ +{ pkgs ? import {} }: +#{ writeScript ? pkgs.writeScript, lib ? pkgs.lib, stdenv ? pkgs.stdenv }: +with pkgs; +let + compileShell = src: buildInputs: name: stdenv.mkDerivation { + inherit name src; + buildInputs = buildInputs ++ [makeWrapper]; + unpackPhase = "true"; + installPhase = ''mkdir -p $out/bin && cp $src $out/bin/${name} + wrapProgram $out/bin/${name} --suffix PATH : ${lib.makeSearchPath "bin" buildInputs} + ''; + }; +in lib.mapAttrs (k: f: f k) { + backup = compileShell ./backup.sh + (with pkgs; [utillinux duplicity]); + brightness = compileShell ./brightne.sh + (with pkgs; [bc]); + screenshot_public = compileShell ./screenshot_public.sh + (with pkgs; [scrot xclip rsync]); +} diff --git a/bin/vga_setup.sh b/bin/vga_setup.sh index 4a69f94..27af8e3 100755 --- a/bin/vga_setup.sh +++ b/bin/vga_setup.sh @@ -1,3 +1,2 @@ xrandr --output VGA-0 --preferred --left-of LVDS-0 --output LVDS-0 --primary -feh --bg-fill ~/dotfiles/awesome/wallpaper.png echo "power on" | sudo bluetoothctl diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..941688e --- /dev/null +++ b/default.nix @@ -0,0 +1,12 @@ +{pkgs ? import {}}: + +let +bin = pkgs.callPackage ./bin/default.nix {}; +i3 = pkgs.callPackage ./i3/i3.nix {inherit (bin) brightness screenshot_public;}; +in +{ + ascanius = pkgs.symlinkJoin { paths = [i3]; name = "dotfiles-ascanius"; }; + woodhouse = []; + pennyworth = []; + frumar = []; +} diff --git a/gtk/.config/gtk-3.0/settings.ini b/gtk/.config/gtk-3.0/settings.ini new file mode 100644 index 0000000..3076972 --- /dev/null +++ b/gtk/.config/gtk-3.0/settings.ini @@ -0,0 +1,3 @@ +[Settings] +gtk-theme-name = Arc-Dark +gtk-font-name = Source Code Pro 10 diff --git a/gtk/.gtkrc-2.0 b/gtk/.gtkrc-2.0 new file mode 100644 index 0000000..1289bc3 --- /dev/null +++ b/gtk/.gtkrc-2.0 @@ -0,0 +1,2 @@ +gtk-theme-name = "Arc-Dark" +gtk-font-name = "Source Code Pro 10" diff --git a/i3/.config/i3/config b/i3/.config/i3/config new file mode 120000 index 0000000..60517c3 --- /dev/null +++ b/i3/.config/i3/config @@ -0,0 +1 @@ +/home/yorick/dotfiles/result/i3-config \ No newline at end of file diff --git a/i3/.config/i3status/config b/i3/.config/i3status/config new file mode 100644 index 0000000..9afcda1 --- /dev/null +++ b/i3/.config/i3status/config @@ -0,0 +1,63 @@ +# i3status configuration file. +# see "man i3status" for documentation. + +# It is important that this file is edited as UTF-8. +# The following line should contain a sharp s: +# ß +# If the above line is not correctly displayed, fix your editor first! + +general { + colors = true + interval = 5 +} + +#order += "ipv6" +order += "disk /" +#order += "run_watch DHCP" +#order += "run_watch VPN" +order += "wireless _first_" +order += "ethernet _first_" +order += "battery 0" + +order += "cpu_temperature 0" +cpu_temperature 0 { + format = "T:%degrees°C" +} + +order += "load" +order += "tztime local" + +wireless _first_ { + format_up = "☁:%quality@%essid,%ip" + format_down = "☁:☓" +} + +ethernet _first_ { + # if you use %speed, i3status requires root privileges + format_up = "E: %ip (%speed)" + format_down = "E:☓" +} + +battery 0 { + format = "%status %percentage %remaining" +} + +run_watch DHCP { + pidfile = "/var/run/dhcpcd.pid" +} + +run_watch VPN { + pidfile = "/var/run/vpnc/pid" +} + +tztime local { + format = "%d/%m %H:%M" +} + +load { + format = "%1min" +} + +disk "/" { + format = "%avail" +} diff --git a/i3/.stow-local-ignore b/i3/.stow-local-ignore new file mode 100644 index 0000000..92c775a --- /dev/null +++ b/i3/.stow-local-ignore @@ -0,0 +1 @@ +i3.nix diff --git a/i3/i3.nix b/i3/i3.nix new file mode 100644 index 0000000..00ddc24 --- /dev/null +++ b/i3/i3.nix @@ -0,0 +1,180 @@ +{writeTextDir, writeScript, +rofi, xautolock, nitrogen, compton-git, i3status, i3-gaps +, i3lock-fancy, xset, alsaUtils, brightness, screenshot_public}: + +let +locker = writeScript "dlock.sh" '' +#!/bin/sh +revert() { + ${xset}/bin/xset dpms 0 0 0 +} +trap revert SIGHUP SIGINT SIGTERM +${xset}/bin/xset +dpms dpms 5 5 5 +${i3lock-fancy}/bin/i3lock-fancy -n +revert +''; + +in + +writeTextDir "i3-config" '' +# i3 config file (v4) +# Please see http://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +gaps inner 5 +gaps outer 5 + +font pango:Source Code Pro 9 + +# Before i3 v4.8, we used to recommend this one as the default: +# font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 +# The font above is very space-efficient, that is, it looks good, sharp and +# clear in small sizes. However, its unicode glyph coverage is limited, the old +# X core fonts rendering does not support right-to-left and this being a bitmap +# font, it doesn’t scale on retina/hidpi displays. + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+c kill + +# start dmenu (a program launcher) +bindsym $mod+e exec --no-startup-id ${rofi}/bin/rofi -fuzzy -show drun +bindsym $mod+z exec --no-startup-id ${rofi}/bin/rofi -fuzzy -show window + +# change focus +bindsym $mod+j focus left +bindsym $mod+k focus down +bindsym $mod+l focus up +bindsym $mod+semicolon focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+j move left +bindsym $mod+Shift+k move down +bindsym $mod+Shift+l move up +bindsym $mod+Shift+semicolon move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+h split h + +# split in vertical orientation +bindsym $mod+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+d layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# switch to workspace +bindsym $mod+1 workspace 1 +bindsym $mod+2 workspace 2 +bindsym $mod+3 workspace 3 +bindsym $mod+4 workspace 4 +bindsym $mod+5 workspace 5 +bindsym $mod+6 workspace 6 +bindsym $mod+7 workspace 7 +bindsym $mod+8 workspace 8 +bindsym $mod+9 workspace 9 +bindsym $mod+0 workspace 10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace 1 +bindsym $mod+Shift+2 move container to workspace 2 +bindsym $mod+Shift+3 move container to workspace 3 +bindsym $mod+Shift+4 move container to workspace 4 +bindsym $mod+Shift+5 move container to workspace 5 +bindsym $mod+Shift+6 move container to workspace 6 +bindsym $mod+Shift+7 move container to workspace 7 +bindsym $mod+Shift+8 move container to workspace 8 +bindsym $mod+Shift+9 move container to workspace 9 +bindsym $mod+Shift+0 move container to workspace 10 + +bindsym $mod+ctrl+r reload +bindsym $mod+Shift+r restart +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'" + +bindsym $mod+ctrl+l exec --no-startup-id ${xautolock}/bin/xautolock -locknow + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window’s width. + # Pressing right will grow the window’s width. + # Pressing up will shrink the window’s height. + # Pressing down will grow the window’s height. + bindsym j resize shrink width 10 px or 10 ppt + bindsym k resize grow height 10 px or 10 ppt + bindsym l resize shrink height 10 px or 10 ppt + bindsym semicolon resize grow width 10 px or 10 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 10 px or 10 ppt + bindsym Down resize grow height 10 px or 10 ppt + bindsym Up resize shrink height 10 px or 10 ppt + bindsym Right resize grow width 10 px or 10 ppt + + # back to normal: Enter or Escape + bindsym Return mode "default" + bindsym Escape mode "default" +} + +bindsym $mod+r mode "resize" +bindsym $mod+Escape workspace back_and_forth + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + i3bar_command ${i3-gaps}/bin/i3bar -t + status_command ${i3status}/bin/i3status + colors { + background #002b36d9 + statusline #839496 + } +} + +exec --no-startup-id ${nitrogen}/bin/nitrogen --restore +exec --no-startup-id ${compton-git}/bin/compton -c /home/yorick/dotfiles/x/compton.conf +exec --no-startup-id ${xautolock}/bin/xautolock -time 15 -locker ${locker} -lockaftersleep + +bindsym XF86MonBrightnessUp exec ${brightness}/bin/brightness up 50 +bindsym XF86MonBrightnessDown exec ${brightness}/bin/brightness down 50 +bindsym XF86AudioLowerVolume exec ${alsaUtils}/bin/amixer set Master 1%- +bindsym XF86AudioRaiseVolume exec ${alsaUtils}/bin/amixer set Master 1%+ +bindsym XF86AudioMute exec ${alsaUtils}/bin/amixer set Master toggle +bindsym $mod+Shift+s exec --no-startup-id ${screenshot_public}/bin/screenshot_public + + +'' diff --git a/install.sh b/install.sh index 34288af..740c419 100755 --- a/install.sh +++ b/install.sh @@ -1,3 +1,4 @@ #!/usr/bin/env nix-shell #!nix-shell -i bash -p stow -stow -d `dirname $0` -t ~ nix git x pentadactyl +stow -d `dirname $0` -t ~ nix git x pentadactyl i3 gtk +nix-build -A $(hostname -s) diff --git a/nix/.nixpkgs/config.nix b/nix/.nixpkgs/config.nix index f501afb..c5ad824 100644 --- a/nix/.nixpkgs/config.nix +++ b/nix/.nixpkgs/config.nix @@ -21,7 +21,7 @@ org = pkgs.emacsPackages.org.overrideDerivation (attrs: { nativeBuildInputs = [emacs texinfo tetex]; }); - wine = pkgs.wine.override { wineRelease = "staging"; wineBuild = "wineWow"; }; + #wine = pkgs.wine.override { wineRelease = "staging"; wineBuild = "wineWow"; }; ftb = pkgs.callPackage ./ftb.nix {}; pyroscope = pkgs.callPackage ./pyroscope.nix {}; @@ -35,6 +35,14 @@ }); }; + weiightminder = pkgs.callPackage (fetchgit { + url = https://gist.github.com/yorickvP/229d21a7da13c9c514dbd26147822641; + rev = "482103c3fb02ab69d1f0787fda1d9ec2272daf72"; + sha256 = "1fql3z6qv1is1jarjp24bqb7g5xi5sfchl9jqjd54yjvjxl0q61v"; + }) {}; + + yscripts = pkgs.callPackage ../../bin {}; + envs = recurseIntoAttrs { @@ -43,13 +51,16 @@ hicolor_icon_theme arc-gtk-theme libnotify - scrot byzanz xclip - #rxvt_unicode-with-plugins + rxvt_unicode arandr xorg.xrandr - feh pavucontrol ]; + scripts = mkEnv "y-scripts" ([ + peageprint + weiightminder + ] ++ (with yscripts; [brightness])); + apps = mkEnv "y-apps" [ gajim mutt @@ -57,6 +68,7 @@ chromium firefox-bin gimp + tdesktop #hexchat #inkscape keepassx @@ -104,7 +116,7 @@ emacs = mkEnv "y-emacs" [emacs org emcn.smex emcn.agda2-mode emc.colorThemeSolarized]; code_min = mkEnv "y-codemin" [ - python gitAndTools.hub gnumake cloc + python gitAndTools.hub gnumake cloc silver-searcher ]; code = mkEnv "y-code" [ cloc graphviz sloccount silver-searcher @@ -148,7 +160,7 @@ }; hosts = { - ascanius = with envs; [apps code_min de games envs.js pdf nix media gcc misc]; + ascanius = with envs; [apps code_min de games envs.js pdf nix media gcc misc scripts coins]; woodhouse = with envs; [de media misc kodi chromium spotify]; pennyworth = []; frumar = with envs; [bup git-annex rtorrent pyroscope]; @@ -165,6 +177,7 @@ babel # some optional dependencies of pandoc upquote microtype csquotes + mathtools ; }); }; diff --git a/x/.Xdefaults b/x/.Xdefaults new file mode 100644 index 0000000..aa8f379 --- /dev/null +++ b/x/.Xdefaults @@ -0,0 +1,71 @@ +! Common +#define S_yellow #b58900 +#define S_orange #cb4b16 +#define S_red #dc322f +#define S_magenta #d33682 +#define S_violet #6c71c4 +#define S_blue #268bd2 +#define S_cyan #2aa198 +#define S_green #859900 +! Dark +#define S_base03 #002b36 +#define S_base02 #073642 +#define S_base01 #586e75 +#define S_base00 #657b83 +#define S_base0 #839496 +#define S_base1 #93a1a1 +#define S_base2 #eee8d5 +#define S_base3 #fdf6e3 +! Light +! #define S_base03 #fdf6e3 +! #define S_base02 #eee8d5 +! #define S_base01 #93a1a1 +! #define S_base00 #839496 +! #define S_base0 #657b83 +! #define S_base1 #586e75 +! #define S_base2 #073642 +! #define S_base3 #002b36 +! To only apply colors to your terminal, for example, prefix +! the color assignment statement with its name. Example: +! +! URxvt*background: S_base03 +*background: S_base3 +URxvt*background: [85]#002b36 +! S_base03 +*foreground: S_base0 +*fading: 10 +*fadeColor: [70]#002b36 +*cursorColor: S_base1 +*pointerColorBackground: S_base01 +*pointerColorForeground: S_base1 +*color0: S_base02 +*color1: S_red +*color2: S_green +*color3: S_yellow +*color4: S_blue +*color5: S_magenta +*color6: S_cyan +*color7: S_base2 +*color8: S_base01 +*color9: S_orange +*color10: S_base01 +*color11: S_base00 +*color12: S_base0 +*color13: S_violet +*color14: S_base1 +*color15: S_base3 +! scrollbar style - xvt (default), plain (most compact), next, or xterm +URxvt.scrollstyle: plain +URxvt.scrollBar_right: true +URxvt.perl-ext-common: default,matcher +URxvt.urlLauncher: /usr/bin/firefox +URxvt.matcher.button: 1 +URxvt.urgentOnBell: True +URxvt.depth: 32 +! URxvt.background: [95]#202020 +URxvt.font: xft:SourceCodePro:pixelsize=16:antialias=true:hinting=true +! URxvt.boldFont: xft:SourceCodePro:bold:pixelsize=14:antialias=true:hinting=true +URxvt.geometry: 100x30 +URxvt.scrollColor: S_base0 + +rofi.font: Source Code Pro 12 diff --git a/x/.stow-local-ignore b/x/.stow-local-ignore new file mode 100644 index 0000000..326879c --- /dev/null +++ b/x/.stow-local-ignore @@ -0,0 +1 @@ +compton.conf diff --git a/x/compton.conf b/x/compton.conf new file mode 100644 index 0000000..29355ea --- /dev/null +++ b/x/compton.conf @@ -0,0 +1,19 @@ +# compton (https://github.com/chjj/compton) compositor config + +# Latest git master version of compton is recommended. Configuring compton is +# tricky, these settings are what work for me with NVIDIA GeForce GTX 650 Ti, +# and the nvidia-352 driver. + +# Use GLX backend for performance and vsync: +backend = "glx" + +# Various performance optimizations: +paint-on-overlay = true; +glx-no-stencil = true; +glx-no-rebind-pixmap = true; + +# With newer NVIDIA drivers, this option is needed to prevent lags/flickering: +xrender-sync-fence = true; + +unredir-if-possible = true; +vsync = "opengl-swc";