home/qtile: add volume keys and ease testing
This commit is contained in:
parent
dd4cd9aaf4
commit
b53ad263e6
3 changed files with 89 additions and 63 deletions
11
Justfile
11
Justfile
|
@ -44,6 +44,17 @@ update-this-device:
|
|||
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
|
||||
disk-prepare:
|
||||
echo NOT IMPLEMENTED
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{ pkgs
|
||||
, config,
|
||||
, config,
|
||||
... }:
|
||||
|
||||
let
|
||||
|
@ -40,7 +40,7 @@ in {
|
|||
enableStatic = true;
|
||||
};
|
||||
|
||||
myPython36 = python36Full.withPackages (ps: with ps; [
|
||||
myPython36 = python36Full.withPackages (ps: with ps; [
|
||||
pylint pep8 yapf flake8
|
||||
# autopep8 (broken)
|
||||
# pylint (broken)
|
||||
|
@ -75,7 +75,7 @@ in {
|
|||
|
||||
GOPATH="$HOME/src/go";
|
||||
|
||||
PATH=pkgs.lib.concatStringsSep ":" [
|
||||
PATH=pkgs.lib.concatStringsSep ":" [
|
||||
"$HOME/.local/bin"
|
||||
"$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin"
|
||||
"$HOME/.cargo/bin"
|
||||
|
@ -201,7 +201,7 @@ in {
|
|||
iftop
|
||||
iperf
|
||||
bind
|
||||
socat
|
||||
socat
|
||||
|
||||
# samba
|
||||
iptables
|
||||
|
@ -215,7 +215,7 @@ in {
|
|||
# (vscode-with-extensions.override {
|
||||
# # When the extension is already available in the default extensions set.
|
||||
# vscodeExtensions = with vscode-extensions; [
|
||||
# ]
|
||||
# ]
|
||||
# # Concise version from the vscode market place when not available in the default set.
|
||||
# ++ vscode-utils.extensionsFromVscodeMarketplace [
|
||||
# {
|
||||
|
@ -250,7 +250,7 @@ in {
|
|||
eclipses.eclipse-modeling
|
||||
dia
|
||||
astah-community
|
||||
|
||||
|
||||
# Misc Development Tools
|
||||
qrcode
|
||||
travis
|
||||
|
@ -271,12 +271,12 @@ in {
|
|||
perlPackages.FileHomeDir
|
||||
perlPackages.UnicodeLineBreak
|
||||
(texlive.combine {
|
||||
inherit (texlive)
|
||||
inherit (texlive)
|
||||
scheme-small
|
||||
texlive-de
|
||||
texlive-en
|
||||
texlive-scripts
|
||||
collection-langgerman
|
||||
collection-langgerman
|
||||
|
||||
latexindent
|
||||
latexmk
|
||||
|
@ -368,7 +368,7 @@ in {
|
|||
dex
|
||||
roxterm
|
||||
# kitty
|
||||
busyboxStatic
|
||||
busyboxStatic
|
||||
xorg.xbacklight
|
||||
coreutils
|
||||
lsof
|
||||
|
@ -391,5 +391,5 @@ in {
|
|||
obs-studio
|
||||
shotcut
|
||||
openshot-qt
|
||||
]);
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,28 @@ let
|
|||
inherit (import ../lib.nix { })
|
||||
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.command import lazy
|
||||
from libqtile import layout, bar, widget
|
||||
|
@ -24,45 +44,45 @@ handler = logging.handlers.RotatingFileHandler(
|
|||
handler.setLevel(logging.WARN)
|
||||
logger.addHandler(handler)
|
||||
|
||||
@hook.subscribe.screen_change
|
||||
def restart_on_randr(qtile, ev):
|
||||
import time
|
||||
|
||||
with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "w"):
|
||||
pass
|
||||
|
||||
lastRestart = 0
|
||||
with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "r+") as lastRestartFile:
|
||||
lastRestartStr = lastRestartFile.read()
|
||||
if len(lastRestartStr) > 0:
|
||||
lastRestart = float(lastRestartStr)
|
||||
|
||||
print("screen changed. (last change: %s)" % lastRestart)
|
||||
|
||||
delta=time.time()-lastRestart
|
||||
if delta > 3:
|
||||
import subprocess
|
||||
lastRestartFile.seek(0)
|
||||
lastRestartFile.write("%s" % time.time())
|
||||
lastRestartFile.truncate()
|
||||
|
||||
subprocess.call(["autorandr","-c"])
|
||||
qtile.cmd_restart()
|
||||
else:
|
||||
print("screen is changing too fast: %s" % delta)
|
||||
|
||||
active_screen = 0
|
||||
@hook.subscribe.client_focus
|
||||
def focus_changed(window):
|
||||
global active_screen
|
||||
pass
|
||||
active_screen = window.group.screen.index
|
||||
|
||||
@hook.subscribe.current_screen_change
|
||||
def move_widget():
|
||||
global active_screen
|
||||
systray = widget.Systray()
|
||||
logging.warn("Screen changed to %i" % active_screen)
|
||||
# @hook.subscribe.screen_change
|
||||
# def restart_on_randr(qtile, ev):
|
||||
# import time
|
||||
#
|
||||
# with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "w"):
|
||||
# pass
|
||||
#
|
||||
# lastRestart = 0
|
||||
# with open(os.path.join(os.environ['HOME'], ".qtilelastrestart"), "r+") as lastRestartFile:
|
||||
# lastRestartStr = lastRestartFile.read()
|
||||
# if len(lastRestartStr) > 0:
|
||||
# lastRestart = float(lastRestartStr)
|
||||
#
|
||||
# print("screen changed. (last change: %s)" % lastRestart)
|
||||
#
|
||||
# delta=time.time()-lastRestart
|
||||
# if delta > 3:
|
||||
# import subprocess
|
||||
# lastRestartFile.seek(0)
|
||||
# lastRestartFile.write("%s" % time.time())
|
||||
# lastRestartFile.truncate()
|
||||
#
|
||||
# subprocess.call(["autorandr","-c"])
|
||||
# qtile.cmd_restart()
|
||||
# else:
|
||||
# print("screen is changing too fast: %s" % delta)
|
||||
#
|
||||
# active_screen = 0
|
||||
# @hook.subscribe.client_focus
|
||||
# def focus_changed(window):
|
||||
# global active_screen
|
||||
# pass
|
||||
# active_screen = window.group.screen.index
|
||||
#
|
||||
# @hook.subscribe.current_screen_change
|
||||
# def move_widget():
|
||||
# global active_screen
|
||||
# systray = widget.Systray()
|
||||
# logging.warn("Screen changed to %i" % active_screen)
|
||||
|
||||
key_super = "mod4"
|
||||
key_alt = "mod1"
|
||||
|
@ -76,14 +96,11 @@ keys = [
|
|||
Key([key_super], "r", lazy.spawncmd()),
|
||||
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], "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()),
|
||||
|
||||
# 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([], "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")),
|
||||
## 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_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")),
|
||||
|
||||
# FIXME: Backlight currently broken
|
||||
# Key([], "XF86MonBrightnessDown", lazy.spawn("xbacklight -inc -5")),
|
||||
# Key([], "XF86MonBrightnessUp", lazy.spawn("xbacklight -inc 5")),
|
||||
|
||||
Key([], "XF86AudioMute", lazy.spawn("${audio} mute")),
|
||||
Key([], "XF86AudioLowerVolume", lazy.spawn("${audio} lower")),
|
||||
Key([], "XF86AudioRaiseVolume", lazy.spawn("${audio} raise")),
|
||||
Key([], "Print", lazy.spawn("${pkgs.flameshot}/bin/flameshot gui")),
|
||||
]
|
||||
groups = [Group(i) for i in "1234567890"]
|
||||
|
@ -224,7 +239,7 @@ in {
|
|||
};
|
||||
|
||||
pasystray = mkSimpleTrayService {
|
||||
execStart = "${pkgs.pasystray}/bin/pasystray";
|
||||
execStart = "${pkgs.pasystray}/bin/pasystray";
|
||||
};
|
||||
|
||||
cbatticon = mkSimpleTrayService {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue