Simplify & refactor desktop & terminal modules
This commit is contained in:
parent
6b7150ecd8
commit
9d137dc744
29
bin/scratch
Executable file
29
bin/scratch
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRID=scratch
|
||||
CMD='tmux new-session -A -s scratch -n scratch'
|
||||
focused=$(xdotool getactivewindow)
|
||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||
if [[ -n $scratch ]]; then
|
||||
if [[ $focused == $scratch ]]; then
|
||||
xdotool windowkill $scratch
|
||||
else
|
||||
xdotool windowactivate $scratch
|
||||
fi
|
||||
elif command -v alacritty >/dev/null; then
|
||||
alacritty --class $SCRID \
|
||||
-d 90 26 \
|
||||
-e $SHELL -c "$CMD"
|
||||
elif command -v urxvt >/dev/null; then
|
||||
urxvt -name $SCRID \
|
||||
-geometry 100x26 \
|
||||
-e $SHELL -c '${tmux}/bin/tmux new-session -A -s scratch -n scratch'
|
||||
elif command -v xst >/dev/null; then
|
||||
xst -t $SCRID -n $SCRID -c $SCRID \
|
||||
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
||||
-g 100x26 \
|
||||
-e $SHELL
|
||||
else
|
||||
>&2 echo "No shell to launch the scratch terminal with"
|
||||
exit 1
|
||||
fi
|
|
@ -21,8 +21,7 @@ bspc rule -a Firefox split_ratio=0.32
|
|||
bspc rule -a feh state=fullscreen
|
||||
bspc rule -a 'Emacs:org*' state=floating
|
||||
bspc rule -a 'Emacs:scratch' state=floating
|
||||
bspc rule -a URxvt:urxvt-scratch state=floating sticky=on center=on
|
||||
bspc rule -a URxvt:urxvt-calc state=floating sticky=on center=on
|
||||
bspc rule -a '*:scratch' state=floating sticky=on center=on
|
||||
|
||||
|
||||
#
|
||||
|
|
|
@ -3,7 +3,7 @@ DIR="$(fd -L --type d . $HOME | rofi -dmenu -i -p files -columns 1 -theme theme/
|
|||
if [ -d "$DIR" ]; then
|
||||
cd "$DIR"
|
||||
if [[ $1 == "-x" ]]; then
|
||||
st-scratch
|
||||
scratch
|
||||
else
|
||||
xst
|
||||
fi
|
||||
|
|
|
@ -21,10 +21,10 @@ super + {_,shift +}{1-9,0}
|
|||
bspc {desktop -f,node -d} {1-9,10}
|
||||
|
||||
super + Return
|
||||
urxvt -e bash -c "tmux new || tmux attach"
|
||||
$TERMINAL -e bash -c "tmux new || tmux attach"
|
||||
|
||||
super + grave
|
||||
urxvt-scratch
|
||||
scratch
|
||||
|
||||
super + shift + grave
|
||||
emacsclient -e '(open-scratch-frame)'
|
||||
|
@ -61,10 +61,10 @@ Print
|
|||
scrcap
|
||||
# screencast region to mp4
|
||||
super + Print
|
||||
scrrec -s ~/recordings/$(date +%F-%T).mp4
|
||||
scrrec -s ~/shared/$(date +%F-%T).mp4
|
||||
# screencast region to gif
|
||||
super + ctrl + Print
|
||||
scrrec -s ~/recordings/$(date +%F-%T).gif
|
||||
scrrec -s ~/shared/$(date +%F-%T).gif
|
||||
|
||||
XF86MonBrightnessUp
|
||||
light -A 5
|
||||
|
@ -73,10 +73,8 @@ XF86MonBrightnessDown
|
|||
|
||||
XF86AudioMute
|
||||
amixer -q set Master toggle
|
||||
|
||||
XF86AudioLowerVolume
|
||||
amixer -q set Master 10%- unmute
|
||||
|
||||
XF86AudioRaiseVolume
|
||||
amixer -q set Master 10%+ unmute
|
||||
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
my.zsh.rc = ''[ "$TERM" = xst-256color ] && export TERM=xterm-256color'';
|
||||
|
||||
my.packages = with pkgs; [
|
||||
libqalculate # calculator cli w/ currency & unit conversion
|
||||
|
||||
xst # st + nice-to-have extensions
|
||||
(makeDesktopItem {
|
||||
name = "xst";
|
||||
|
@ -16,41 +14,5 @@
|
|||
exec = "${xst}/bin/xst";
|
||||
categories = "Development;System;Utility";
|
||||
})
|
||||
|
||||
(writeScriptBin "st-scratch" ''
|
||||
#!${stdenv.shell}
|
||||
SCRID=st-scratch
|
||||
focused=$(xdotool getactivewindow)
|
||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||
if [[ -n $scratch ]]; then
|
||||
if [[ $focused == $scratch ]]; then
|
||||
xdotool windowkill $scratch
|
||||
else
|
||||
xdotool windowactivate $scratch
|
||||
fi
|
||||
else
|
||||
xst -t $SCRID -n $SCRID -c $SCRID \
|
||||
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
||||
-g 100x26 \
|
||||
-e $SHELL
|
||||
fi
|
||||
'')
|
||||
(writeScriptBin "st-calc" ''
|
||||
#!${stdenv.shell}
|
||||
SCRID=st-calc
|
||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||
[ -n "$scratch" ] && xdotool windowkill $scratch
|
||||
xst -t $SCRID -n $SCRID -c $SCRID \
|
||||
-f "$(xrdb -query | grep 'st-scratch\.font' | cut -f2)" \
|
||||
-g 80x12 \
|
||||
-e $SHELL -c qalc
|
||||
'')
|
||||
(makeDesktopItem {
|
||||
name = "st-calc";
|
||||
desktopName = "Calculator";
|
||||
icon = "calc";
|
||||
exec = "st-calc";
|
||||
categories = "Development";
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -2,41 +2,6 @@
|
|||
|
||||
{
|
||||
my.packages = with pkgs; [
|
||||
libqalculate # calculator cli w/ currency & unit conversion
|
||||
|
||||
rxvt_unicode
|
||||
(writeScriptBin "urxvt-scratch" ''
|
||||
#!${stdenv.shell}
|
||||
SCRID=urxvt-scratch
|
||||
focused=$(xdotool getactivewindow)
|
||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||
if [[ -n $scratch ]]; then
|
||||
if [[ $focused == $scratch ]]; then
|
||||
xdotool windowkill $scratch
|
||||
else
|
||||
xdotool windowactivate $scratch
|
||||
fi
|
||||
else
|
||||
urxvt -name $SCRID \
|
||||
-geometry 100x26 \
|
||||
-e $SHELL -c '${tmux}/bin/tmux new-session -A -s scratch -n scratch'
|
||||
fi
|
||||
'')
|
||||
(writeScriptBin "urxvt-calc" ''
|
||||
#!${stdenv.shell}
|
||||
SCRID=urxvt-calc
|
||||
scratch=$(xdotool search --onlyvisible --classname $SCRID)
|
||||
[ -n "$scratch" ] && xdotool windowkill $scratch
|
||||
urxvt -name $SCRID \
|
||||
-geometry 80x20 \
|
||||
-e $SHELL -c 'qalc'
|
||||
'')
|
||||
(makeDesktopItem {
|
||||
name = "urxvt-calc";
|
||||
desktopName = "Calculator";
|
||||
icon = "calc";
|
||||
exec = "urxvt-calc";
|
||||
categories = "Development";
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -2,21 +2,11 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
./. # common settings
|
||||
# My launcher
|
||||
./apps/rofi.nix
|
||||
# I often need a thumbnail browser to show off, peruse or organize photos,
|
||||
# design work, or digital art.
|
||||
./apps/thunar.nix
|
||||
#
|
||||
./apps/redshift.nix
|
||||
#
|
||||
./apps/urxvt.nix
|
||||
./. # common settings
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
lightdm
|
||||
bspwm
|
||||
dunst
|
||||
libnotify
|
||||
(polybar.override {
|
||||
|
@ -26,24 +16,17 @@
|
|||
];
|
||||
|
||||
services = {
|
||||
xserver = {
|
||||
enable = true;
|
||||
windowManager.bspwm.enable = true;
|
||||
desktopManager.xterm.enable = lib.mkDefault false;
|
||||
displayManager.lightdm = {
|
||||
enable = true;
|
||||
greeters.mini = {
|
||||
enable = true;
|
||||
user = config.my.username;
|
||||
};
|
||||
};
|
||||
};
|
||||
compton.enable = true;
|
||||
xserver = {
|
||||
windowManager.default = "bspwm";
|
||||
windowManager.bspwm.enable = true;
|
||||
displayManager.lightdm.enable = true;
|
||||
displayManager.lightdm.greeters.mini.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# For polybar
|
||||
my = {
|
||||
env.PATH = [ <config/bspwm/bin> ];
|
||||
env.PATH = [ <bin/bspwm> ];
|
||||
home.xdg.configFile = {
|
||||
"sxhkd".source = <config/sxhkd>;
|
||||
# link recursively so other modules can link files in their folders
|
||||
|
|
|
@ -1,17 +1,37 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
my = {
|
||||
packages = with pkgs; [
|
||||
calibre # managing my ebooks
|
||||
evince # pdf reader
|
||||
feh # image viewer
|
||||
mpv # video player
|
||||
xclip
|
||||
xdotool
|
||||
];
|
||||
imports = [
|
||||
## Desktop apps
|
||||
./apps/redshift.nix
|
||||
./apps/rofi.nix # My launcher
|
||||
./apps/thunar.nix # I often need a thumbnail browser to show off, peruse
|
||||
# or organize photos, design work, or digital art.
|
||||
|
||||
## Terminal
|
||||
# ./apps/alacritty.nix
|
||||
# ./apps/st.nix
|
||||
./apps/urxvt.nix
|
||||
];
|
||||
|
||||
my.env.TERMINAL = "urxvt";
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
desktopManager.xterm.enable = lib.mkDefault false;
|
||||
displayManager.lightdm.greeters.mini.user = config.my.username;
|
||||
};
|
||||
|
||||
my.packages = with pkgs; [
|
||||
calibre # managing my ebooks
|
||||
evince # pdf reader
|
||||
feh # image viewer
|
||||
mpv # video player
|
||||
xclip
|
||||
xdotool
|
||||
libqalculate # calculator cli w/ currency conversion
|
||||
];
|
||||
|
||||
## Sound
|
||||
sound.enable = true;
|
||||
hardware.pulseaudio.enable = true;
|
||||
|
|
|
@ -49,28 +49,33 @@
|
|||
*.color241: #665c54
|
||||
|
||||
|
||||
!! general
|
||||
scratch.font: Fira Code:pixelsize=16
|
||||
|
||||
|
||||
!! xst
|
||||
st.opacity: 200
|
||||
st.font: Fira Code:pixelsize=12
|
||||
|
||||
|
||||
!! urxvt
|
||||
URxvt*depth: 32
|
||||
URxvt*.background: [80]#101216
|
||||
! URxvt*.termName: xterm-256color
|
||||
URxvt*.borderless: 1
|
||||
URxvt*.buffered: true
|
||||
URxvt*.cursorBlink: true
|
||||
URxvt*.underlineColor: grey
|
||||
URxvt*.borderless: 1
|
||||
URxvt.iso14755: false
|
||||
URxvt.iso14755_52: false
|
||||
URxvt*.font: xft:Fira Code:pixelsize=12
|
||||
URxvt*.internalBorder: 10
|
||||
URxvt*.scrollBar: false
|
||||
URxvt*.saveLines: 5000
|
||||
URxvt*.letterSpace: 0
|
||||
URxvt*.lineSpace: 0
|
||||
URxvt*.loginShell: false
|
||||
URxvt.perl-ext-common: default,matcher
|
||||
URxvt*.matcher.button: 1
|
||||
URxvt*.matcher.rend.0: Uline Bold fg5
|
||||
URxvt*.saveLines: 5000
|
||||
URxvt*.scrollBar: false
|
||||
URxvt*.underlineColor: grey
|
||||
URxvt.clipboard.autocopy: true
|
||||
|
||||
! fonts
|
||||
URxvt*.lineSpace: 0
|
||||
URxvt*.letterSpace: 0
|
||||
URxvt*.font: xft:Fira Code:pixelsize=12
|
||||
urxvt-scratch.font: xft:Fira Code:pixelsize=16
|
||||
urxvt-calc.font: xft:Fira Code:pixelsize=22
|
||||
URxvt.iso14755: false
|
||||
URxvt.iso14755_52: false
|
||||
URxvt.perl-ext-common: default,matcher
|
||||
|
|
Loading…
Reference in a new issue