Merge staging to master #12

Merged
steveej merged 30 commits from staging into master 2018-11-10 11:10:55 +00:00
3 changed files with 89 additions and 63 deletions
Showing only changes of commit b53ad263e6 - Show all commits

View file

@ -44,6 +44,17 @@ update-this-device:
fi fi
fi fi
hm-iterate-qtile:
#!/usr/bin/env bash
set -xe
home-manager switch
Xephyr -ac -br -resizeable :1 &
XEPHYR_PID=$!
echo ${XEPHYR_PID}
DISPLAY=:1 $(grep qtile ~/.xsession) &
wait $!
kill ${XEPHYR_PID}
# Sorry, this is a manual step for now. Please see nix/os/modules/encryptedDisk.nix for the layout # Sorry, this is a manual step for now. Please see nix/os/modules/encryptedDisk.nix for the layout
disk-prepare: disk-prepare:
echo NOT IMPLEMENTED echo NOT IMPLEMENTED

View file

@ -1,5 +1,5 @@
{ pkgs { pkgs
, config, , config,
... }: ... }:
let let
@ -40,7 +40,7 @@ in {
enableStatic = true; enableStatic = true;
}; };
myPython36 = python36Full.withPackages (ps: with ps; [ myPython36 = python36Full.withPackages (ps: with ps; [
pylint pep8 yapf flake8 pylint pep8 yapf flake8
# autopep8 (broken) # autopep8 (broken)
# pylint (broken) # pylint (broken)
@ -75,7 +75,7 @@ in {
GOPATH="$HOME/src/go"; GOPATH="$HOME/src/go";
PATH=pkgs.lib.concatStringsSep ":" [ PATH=pkgs.lib.concatStringsSep ":" [
"$HOME/.local/bin" "$HOME/.local/bin"
"$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin" "$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin"
"$HOME/.cargo/bin" "$HOME/.cargo/bin"
@ -201,7 +201,7 @@ in {
iftop iftop
iperf iperf
bind bind
socat socat
# samba # samba
iptables iptables
@ -215,7 +215,7 @@ in {
# (vscode-with-extensions.override { # (vscode-with-extensions.override {
# # When the extension is already available in the default extensions set. # # When the extension is already available in the default extensions set.
# vscodeExtensions = with vscode-extensions; [ # vscodeExtensions = with vscode-extensions; [
# ] # ]
# # Concise version from the vscode market place when not available in the default set. # # Concise version from the vscode market place when not available in the default set.
# ++ vscode-utils.extensionsFromVscodeMarketplace [ # ++ vscode-utils.extensionsFromVscodeMarketplace [
# { # {
@ -250,7 +250,7 @@ in {
eclipses.eclipse-modeling eclipses.eclipse-modeling
dia dia
astah-community astah-community
# Misc Development Tools # Misc Development Tools
qrcode qrcode
travis travis
@ -271,12 +271,12 @@ in {
perlPackages.FileHomeDir perlPackages.FileHomeDir
perlPackages.UnicodeLineBreak perlPackages.UnicodeLineBreak
(texlive.combine { (texlive.combine {
inherit (texlive) inherit (texlive)
scheme-small scheme-small
texlive-de texlive-de
texlive-en texlive-en
texlive-scripts texlive-scripts
collection-langgerman collection-langgerman
latexindent latexindent
latexmk latexmk
@ -368,7 +368,7 @@ in {
dex dex
roxterm roxterm
# kitty # kitty
busyboxStatic busyboxStatic
xorg.xbacklight xorg.xbacklight
coreutils coreutils
lsof lsof
@ -391,5 +391,5 @@ in {
obs-studio obs-studio
shotcut shotcut
openshot-qt openshot-qt
]); ]);
} }

View file

@ -6,8 +6,28 @@ let
inherit (import ../lib.nix { }) inherit (import ../lib.nix { })
mkSimpleTrayService mkSimpleTrayService
; ;
qtileConfig = pkgs.writeScript "config.py" '' audio = pkgs.writeScript "audio" ''
#!${pkgs.bash}/bin/bash
case $1 in
mute)
${pkgs.pulseaudio}/bin/pactl set-sink-mute $(${pkgs.pulseaudio}/bin/pactl list short sinks | grep RUNNING | awk '{ print $1 }') toggle
;;
lower)
${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pactl list short sinks | grep RUNNING | awk '{ print $1 }') -10%
;;
raise)
${pkgs.pulseaudio}/bin/pactl set-sink-volume $(${pkgs.pulseaudio}/bin/pactl list short sinks | grep RUNNING | awk '{ print $1 }') +10%
;;
*)
echo Unknown command: $1
exit 1
;;
esac
'';
qtileConfig = pkgs.writeScript "qtile_config.py" ''
from libqtile.config import Key, Screen, Group, Drag, Click from libqtile.config import Key, Screen, Group, Drag, Click
from libqtile.command import lazy from libqtile.command import lazy
from libqtile import layout, bar, widget from libqtile import layout, bar, widget
@ -24,45 +44,45 @@ handler = logging.handlers.RotatingFileHandler(
handler.setLevel(logging.WARN) handler.setLevel(logging.WARN)
logger.addHandler(handler) logger.addHandler(handler)
@hook.subscribe.screen_change # @hook.subscribe.screen_change
def restart_on_randr(qtile, ev): # def restart_on_randr(qtile, ev):
import time # import time
#
with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "w"): # with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "w"):
pass # pass
#
lastRestart = 0 # lastRestart = 0
with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "r+") as lastRestartFile: # with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "r+") as lastRestartFile:
lastRestartStr = lastRestartFile.read() # lastRestartStr = lastRestartFile.read()
if len(lastRestartStr) > 0: # if len(lastRestartStr) > 0:
lastRestart = float(lastRestartStr) # lastRestart = float(lastRestartStr)
#
print("screen changed. (last change: %s)" % lastRestart) # print("screen changed. (last change: %s)" % lastRestart)
#
delta=time.time()-lastRestart # delta=time.time()-lastRestart
if delta > 3: # if delta > 3:
import subprocess # import subprocess
lastRestartFile.seek(0) # lastRestartFile.seek(0)
lastRestartFile.write("%s" % time.time()) # lastRestartFile.write("%s" % time.time())
lastRestartFile.truncate() # lastRestartFile.truncate()
#
subprocess.call(["autorandr","-c"]) # subprocess.call(["autorandr","-c"])
qtile.cmd_restart() # qtile.cmd_restart()
else: # else:
print("screen is changing too fast: %s" % delta) # print("screen is changing too fast: %s" % delta)
#
active_screen = 0 # active_screen = 0
@hook.subscribe.client_focus # @hook.subscribe.client_focus
def focus_changed(window): # def focus_changed(window):
global active_screen # global active_screen
pass # pass
active_screen = window.group.screen.index # active_screen = window.group.screen.index
#
@hook.subscribe.current_screen_change # @hook.subscribe.current_screen_change
def move_widget(): # def move_widget():
global active_screen # global active_screen
systray = widget.Systray() # systray = widget.Systray()
logging.warn("Screen changed to %i" % active_screen) # logging.warn("Screen changed to %i" % active_screen)
key_super = "mod4" key_super = "mod4"
key_alt = "mod1" key_alt = "mod1"
@ -76,14 +96,11 @@ keys = [
Key([key_super], "r", lazy.spawncmd()), Key([key_super], "r", lazy.spawncmd()),
Key([key_super], "w", lazy.window.kill()), Key([key_super], "w", lazy.window.kill()),
# Key([key_alt, key_super], "l", lazy.spawn("xscreensaver-command -lock")),
# Key([key_alt, key_super], "l", lazy.spawn("sh -c '(sleep 1; xset dpms force off) & xautolock -locknow'")),
# Key([key_alt, key_super], "l", lazy.spawn("light-locker-command -l")),
# Key([key_alt, key_super], "l", lazy.spawn("dm-tool lock")),
Key([key_alt, key_super], "l", lazy.spawn('${pkgs.bash}/bin/sh -c "loginctl lock-session $XDG_SESSION_ID"')), Key([key_alt, key_super], "l", lazy.spawn('${pkgs.bash}/bin/sh -c "loginctl lock-session $XDG_SESSION_ID"')),
Key([key_alt, key_super], "s", lazy.spawn("${pkgs.systemd}/bin/systemctl suspend")), Key([key_alt, key_super], "s", lazy.spawn("${pkgs.systemd}/bin/systemctl suspend")),
Key([key_super, key_control], "r", lazy.restart()), # Key([key_super, key_control], "r", lazy.restart()),
Key([key_super, key_control], "r", lazy.spawn("${pkgs.autorandr}/bin/autorandr -c"), lazy.restart()),
Key([key_super, key_control], "q", lazy.shutdown()), Key([key_super, key_control], "q", lazy.shutdown()),
# Toggle between different layouts as defined below # Toggle between different layouts as defined below
@ -134,14 +151,12 @@ keys = [
Key([], "XF86AudioPlay", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")), Key([], "XF86AudioPlay", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause")),
Key([], "XF86AudioPrev", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")), Key([], "XF86AudioPrev", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")),
Key([], "XF86AudioNext", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")), Key([], "XF86AudioNext", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")),
## Microsoft Comfort Curve specific ## Microsoft Comfort Curve specific
Key([key_super, "shift"], "XF86TouchpadToggle", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")), Key([key_super, "shift"], "XF86TouchpadToggle", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")),
Key([key_alt, key_super], "XF86TouchpadToggle", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")), Key([key_alt, key_super], "XF86TouchpadToggle", lazy.spawn("${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next")),
Key([], "XF86AudioMute", lazy.spawn("${audio} mute")),
# FIXME: Backlight currently broken Key([], "XF86AudioLowerVolume", lazy.spawn("${audio} lower")),
# Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -inc -5")), Key([], "XF86AudioRaiseVolume", lazy.spawn("${audio} raise")),
# Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 5")),
Key([], "Print", lazy.spawn("${pkgs.flameshot}/bin/flameshot gui")), Key([], "Print", lazy.spawn("${pkgs.flameshot}/bin/flameshot gui")),
] ]
groups = [Group(i) for i in "1234567890"] groups = [Group(i) for i in "1234567890"]
@ -224,7 +239,7 @@ in {
}; };
pasystray = mkSimpleTrayService { pasystray = mkSimpleTrayService {
execStart = "${pkgs.pasystray}/bin/pasystray"; execStart = "${pkgs.pasystray}/bin/pasystray";
}; };
cbatticon = mkSimpleTrayService { cbatticon = mkSimpleTrayService {