mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-05-19 02:46:06 -07:00
update after a long time
This commit is contained in:
parent
b6544dcc59
commit
d6bbdde829
18
.bashrc
18
.bashrc
@ -1,27 +1,29 @@
|
|||||||
#
|
#
|
||||||
# ~/.bashrc
|
# ~/.bashrc
|
||||||
|
|
||||||
export PATH=$PATH:~/.cabal/bin
|
|
||||||
#export PATH=$PATH:~/.local/bin
|
if [ -d "$HOME/.local/bin" ] ; then
|
||||||
|
PATH="$PATH:$HOME/.local/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH=$PATH:~/.local/bin
|
||||||
alias lol="sudo sh -c 'sysctl -w abi.vsyscall32=0'"
|
alias lol="sudo sh -c 'sysctl -w abi.vsyscall32=0'"
|
||||||
alias dired="emacsclient -c -nw -a '' --eval '(dired nil)'"
|
alias dired="emacsclient -c -nw -a '' --eval '(dired nil)'"
|
||||||
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
||||||
alias update-xmonad="yay -S xmonad-git xmonad-contrib-git xmobar-git"
|
alias update-xmonad="yay -S xmonad-git xmonad-contrib-git xmobar-git"
|
||||||
alias git-python='/usr/bin/git --git-dir=$HOME/devel/python/python-bits-and-bobs --work-tree=$HOME/devel/python'
|
alias git-python='/usr/bin/git --git-dir=$HOME/devel/python/python-bits-and-bobs --work-tree=$HOME/devel/python'
|
||||||
|
|
||||||
alias rm='echo "This is not the command you are looking for."; false'
|
alias rm='echo "This is not the command you are looking for."; false'
|
||||||
alias tp='trash-put'
|
alias tp='trash-put'
|
||||||
alias te='trash-empty'
|
alias te='trash-empty'
|
||||||
alias tl='trash-list'
|
alias tl='trash-list'
|
||||||
alias tre='trash-restore'
|
alias tre='trash-restore'
|
||||||
alias tpm='trash-rm'
|
alias tpm='trash-rm'
|
||||||
|
|
||||||
alias mpv='mpv --title="mpv"'
|
alias mpv='mpv --title="mpv"'
|
||||||
|
|
||||||
alias dot='/usr/bin/git --git-dir=$HOME/.dots --work-tree=$HOME'
|
alias dot='/usr/bin/git --git-dir=$HOME/.dots --work-tree=$HOME'
|
||||||
dot config --local status.showUntrackedFiles no
|
dot config --local status.showUntrackedFiles no
|
||||||
|
|
||||||
#export PATH="$PATH:$(ruby -e 'print Gem.user_dir')/bin"
|
|
||||||
#export GEM_HOME=$(ruby -e 'print Gem.user_dir')
|
|
||||||
|
|
||||||
[ -f "/home/tstarr/.ghcup/env" ] && source "/home/tstarr/.ghcup/env" # ghcup-env
|
|
||||||
|
|
||||||
|
# added by Anaconda3 2.5.0 installer
|
||||||
|
#export PATH="/home/tstarr/anaconda3/bin:$PATH"
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
# This file contains fish universal variable definitions.
|
|
||||||
# VERSION: 3.0
|
|
||||||
SETUVAR __fish_initialized:3100
|
|
||||||
SETUVAR fish_color_autosuggestion:555\x1ebrblack
|
|
||||||
SETUVAR fish_color_cancel:\x2dr
|
|
||||||
SETUVAR fish_color_command:005fd7
|
|
||||||
SETUVAR fish_color_comment:990000
|
|
||||||
SETUVAR fish_color_cwd:green
|
|
||||||
SETUVAR fish_color_cwd_root:red
|
|
||||||
SETUVAR fish_color_end:009900
|
|
||||||
SETUVAR fish_color_error:ff0000
|
|
||||||
SETUVAR fish_color_escape:00a6b2
|
|
||||||
SETUVAR fish_color_history_current:\x2d\x2dbold
|
|
||||||
SETUVAR fish_color_host:normal
|
|
||||||
SETUVAR fish_color_host_remote:yellow
|
|
||||||
SETUVAR fish_color_match:\x2d\x2dbackground\x3dbrblue
|
|
||||||
SETUVAR fish_color_normal:normal
|
|
||||||
SETUVAR fish_color_operator:00a6b2
|
|
||||||
SETUVAR fish_color_param:00afff
|
|
||||||
SETUVAR fish_color_quote:999900
|
|
||||||
SETUVAR fish_color_redirection:00afff
|
|
||||||
SETUVAR fish_color_search_match:bryellow\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_selection:white\x1e\x2d\x2dbold\x1e\x2d\x2dbackground\x3dbrblack
|
|
||||||
SETUVAR fish_color_status:red
|
|
||||||
SETUVAR fish_color_user:brgreen
|
|
||||||
SETUVAR fish_color_valid_path:\x2d\x2dunderline
|
|
||||||
SETUVAR fish_greeting:Welcome\x20to\x20fish\x2c\x20the\x20friendly\x20interactive\x20shell\x0aType\x20\x60help\x60\x20for\x20instructions\x20on\x20how\x20to\x20use\x20fish
|
|
||||||
SETUVAR fish_key_bindings:fish_default_key_bindings
|
|
||||||
SETUVAR fish_pager_color_completion:\x1d
|
|
||||||
SETUVAR fish_pager_color_description:B3A06D\x1eyellow
|
|
||||||
SETUVAR fish_pager_color_prefix:white\x1e\x2d\x2dbold\x1e\x2d\x2dunderline
|
|
||||||
SETUVAR fish_pager_color_progress:brwhite\x1e\x2d\x2dbackground\x3dcyan
|
|
@ -5,6 +5,7 @@ from settings.layouts import layouts, floating_layout
|
|||||||
from settings.widgets import widget_defaults, extension_defaults
|
from settings.widgets import widget_defaults, extension_defaults
|
||||||
from settings.screens import screens
|
from settings.screens import screens
|
||||||
from settings.mouse import mouse
|
from settings.mouse import mouse
|
||||||
|
from settings.rules import dgroups_app_rules
|
||||||
from settings.path import qtile_path
|
from settings.path import qtile_path
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
from libqtile.config import EzKey
|
from libqtile.config import EzKey
|
||||||
from libqtile.command import lazy
|
from libqtile.command import lazy
|
||||||
from libqtile import qtile
|
from libqtile import qtile
|
||||||
|
import settings.traverse as traverse
|
||||||
|
|
||||||
# Set mod key to the "windows" key
|
# Set mod key to the "windows" key
|
||||||
mod = "mod4"
|
mod = "mod4"
|
||||||
@ -28,10 +29,10 @@ keys = [EzKey(k[0], *k[1:]) for k in [
|
|||||||
|
|
||||||
# ------ Movement ------ #
|
# ------ Movement ------ #
|
||||||
# Navigate between windows
|
# Navigate between windows
|
||||||
("M-h", lazy.layout.left()),
|
("M-h", lazy.function(traverse.left)),
|
||||||
("M-j", lazy.layout.down()),
|
("M-j", lazy.function(traverse.down)),
|
||||||
("M-k", lazy.layout.up()),
|
("M-k", lazy.function(traverse.up)),
|
||||||
("M-l", lazy.layout.right()),
|
("M-l", lazy.function(traverse.right)),
|
||||||
# Switch windows
|
# Switch windows
|
||||||
("M-S-<space>", lazy.function(switch_screens)),
|
("M-S-<space>", lazy.function(switch_screens)),
|
||||||
# Switch focus between two screens
|
# Switch focus between two screens
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from libqtile import layout
|
from libqtile import layout
|
||||||
from settings.wal import wal
|
from settings.wal import wal
|
||||||
|
from libqtile.config import Match
|
||||||
|
|
||||||
# Layout configs
|
# Layout configs
|
||||||
layout_conf = {
|
layout_conf = {
|
||||||
@ -23,9 +24,9 @@ layouts = [
|
|||||||
# Define floating rules
|
# Define floating rules
|
||||||
floating_layout = layout.Floating(
|
floating_layout = layout.Floating(
|
||||||
float_rules=[
|
float_rules=[
|
||||||
{'wmclass': 'Steam'},
|
Match('wmclass', 'Steam'),
|
||||||
{'wmclass': 'Wine'},
|
Match('wmclass', 'Wine'),
|
||||||
{'wmclass': 'discord'},
|
Match('wmclass', 'discord'),
|
||||||
],
|
],
|
||||||
border_focus=wal['colors']['color2'],
|
border_focus=wal['colors']['color2'],
|
||||||
border_width=1,
|
border_width=1,
|
||||||
|
27
.config/qtile/settings/rules.py
Normal file
27
.config/qtile/settings/rules.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
from libqtile.config import Match, Rule
|
||||||
|
from libqtile import hook
|
||||||
|
|
||||||
|
dgroups_app_rules = [Rule(Match(wm_type=["confirm",
|
||||||
|
"download",
|
||||||
|
"notification",
|
||||||
|
"toolbar",
|
||||||
|
"splash",
|
||||||
|
"dialog",
|
||||||
|
"error",
|
||||||
|
"file_progress",
|
||||||
|
"confirmreset",
|
||||||
|
"makebranch",
|
||||||
|
"maketag",
|
||||||
|
"branchdialog",
|
||||||
|
"pinentry",
|
||||||
|
"sshaskpass"]),
|
||||||
|
float=True),
|
||||||
|
Rule(Match(wm_class=["lutris", "league of legends.exe", "leagueclientux.exe"]),
|
||||||
|
float=True,
|
||||||
|
break_on_match=True)]
|
||||||
|
@hook.subscribe.client_new
|
||||||
|
def floating_dialogs(window):
|
||||||
|
dialog = window.window.get_wm_type() == 'dialog'
|
||||||
|
transient = window.window.get_wm_transient_for()
|
||||||
|
if dialog or transient:
|
||||||
|
window.floating = True
|
@ -1,8 +1,12 @@
|
|||||||
from libqtile.config import Screen
|
from libqtile.config import Screen
|
||||||
from libqtile import bar
|
from libqtile import bar, widget
|
||||||
from settings.widgets import primary_widgets
|
from settings.widgets import primary_widgets
|
||||||
|
|
||||||
# Define the screens (and bars)
|
# Define the screens (and bars)
|
||||||
screens = [
|
screens = [
|
||||||
Screen(top=bar.Bar(primary_widgets, size=20))
|
Screen(top=bar.Bar(widgets=primary_widgets, size=20)),
|
||||||
|
Screen(top=bar.Bar([
|
||||||
|
widget.GroupBox(),
|
||||||
|
widget.WindowName()
|
||||||
|
], 20),)
|
||||||
]
|
]
|
||||||
|
88
.config/qtile/settings/traverse.py
Normal file
88
.config/qtile/settings/traverse.py
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
"""
|
||||||
|
This plugin exports four functions - up, down, left and right - that when called will
|
||||||
|
move window focus to the first window in that general direction. Focussing is based
|
||||||
|
entirely on position and geometry, so is independent of screens, layouts and whether
|
||||||
|
windows are floating or tiled. It can also move focus to and from empty screens.
|
||||||
|
Example usage:
|
||||||
|
import traverse
|
||||||
|
keys.extend([EzKey(k, v) for k, v in {
|
||||||
|
'M-k': lazy.function(traverse.up)
|
||||||
|
'M-j': lazy.function(traverse.down)
|
||||||
|
'M-h': lazy.function(traverse.left)
|
||||||
|
'M-l': lazy.function(traverse.right)
|
||||||
|
}.items()])
|
||||||
|
"""
|
||||||
|
|
||||||
|
from libqtile.config import Screen
|
||||||
|
|
||||||
|
|
||||||
|
def up(qtile):
|
||||||
|
_focus_window(qtile, -1, 'y')
|
||||||
|
|
||||||
|
|
||||||
|
def down(qtile):
|
||||||
|
_focus_window(qtile, 1, 'y')
|
||||||
|
|
||||||
|
|
||||||
|
def left(qtile):
|
||||||
|
_focus_window(qtile, -1, 'x')
|
||||||
|
|
||||||
|
|
||||||
|
def right(qtile):
|
||||||
|
_focus_window(qtile, 1, 'x')
|
||||||
|
|
||||||
|
|
||||||
|
def _focus_window(qtile, dir, axis):
|
||||||
|
win = None
|
||||||
|
win_wide = None
|
||||||
|
dist = 10000
|
||||||
|
dist_wide = 10000
|
||||||
|
cur = qtile.current_window
|
||||||
|
if not cur:
|
||||||
|
cur = qtile.current_screen
|
||||||
|
|
||||||
|
if axis == 'x':
|
||||||
|
dim = 'width'
|
||||||
|
band_axis = 'y'
|
||||||
|
band_dim = 'height'
|
||||||
|
cur_pos = cur.x
|
||||||
|
band_min = cur.y
|
||||||
|
band_max = cur.y + cur.height
|
||||||
|
else:
|
||||||
|
dim = 'height'
|
||||||
|
band_axis = 'x'
|
||||||
|
band_dim = 'width'
|
||||||
|
band_min = cur.x
|
||||||
|
cur_pos = cur.y
|
||||||
|
band_max = cur.x + cur.width
|
||||||
|
|
||||||
|
cur_pos += getattr(cur, dim) / 2
|
||||||
|
|
||||||
|
windows = [w for g in qtile.groups if g.screen for w in g.windows]
|
||||||
|
windows.extend([s for s in qtile.screens if not s.group.windows])
|
||||||
|
|
||||||
|
if cur in windows:
|
||||||
|
windows.remove(cur)
|
||||||
|
|
||||||
|
for w in windows:
|
||||||
|
if isinstance(w, Screen) or not w.minimized:
|
||||||
|
pos = getattr(w, axis) + getattr(w, dim) / 2
|
||||||
|
gap = dir * (pos - cur_pos)
|
||||||
|
if gap > 5:
|
||||||
|
band_pos = getattr(w, band_axis) + getattr(w, band_dim) / 2
|
||||||
|
if band_min < band_pos < band_max:
|
||||||
|
if gap < dist:
|
||||||
|
dist = gap
|
||||||
|
win = w
|
||||||
|
else:
|
||||||
|
if gap < dist_wide:
|
||||||
|
dist_wide = gap
|
||||||
|
win_wide = w
|
||||||
|
|
||||||
|
if not win:
|
||||||
|
win = win_wide
|
||||||
|
if win:
|
||||||
|
qtile.focus_screen(win.group.screen.index)
|
||||||
|
win.group.focus(win, True)
|
||||||
|
if not isinstance(win, Screen):
|
||||||
|
win.focus(False)
|
@ -1,6 +1,5 @@
|
|||||||
from libqtile import widget
|
from libqtile import widget
|
||||||
from settings.wal import wal
|
from settings.wal import wal
|
||||||
|
|
||||||
spacer_len = 3
|
spacer_len = 3
|
||||||
wal_color = wal["colors"]
|
wal_color = wal["colors"]
|
||||||
|
|
||||||
|
13
.config/qtile/xephyr.sh
Executable file
13
.config/qtile/xephyr.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
echo "cleaning up!"
|
||||||
|
xeph_qtile=0
|
||||||
|
}
|
||||||
|
|
||||||
|
xeph_qtile=1
|
||||||
|
Xephyr -br -ac -noreset -screen 800x600 :1 &
|
||||||
|
export DISPLAY=:1
|
||||||
|
qtile start &
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
@ -1,10 +1,18 @@
|
|||||||
|
|
||||||
status=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_VOLTAGE)
|
status=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_VOLTAGE)
|
||||||
voltage=$(echo $status | cut -c26-29)
|
voltage=$(echo $status | cut -c26-29)
|
||||||
if [ "$voltage" -ge 3200 ]; then
|
if [ "$voltage" -ge 3700 ]; then
|
||||||
color="#b8bb26"
|
color="#b8bb26"
|
||||||
else
|
else
|
||||||
color="#fb4934"
|
color="#fb4934"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "<fc=$color>${voltage}mV</fc>"
|
status1=$(cat /sys/class/power_supply/hidpp_battery_*/uevent | grep POWER_SUPPLY_STATUS | tail -n1)
|
||||||
|
charge=$(echo $status1 | cut -c21-)
|
||||||
|
if [ "$charge" = "Discharging" ]; then
|
||||||
|
color1="#fb4934"
|
||||||
|
else
|
||||||
|
color1="#b8bb26"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "<fc=$color1> </fc><fc=$color>${voltage}mV</fc>"
|
||||||
|
@ -8,6 +8,4 @@ else
|
|||||||
color="#b8bb26"
|
color="#b8bb26"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mpcvolume=$(mpc volume)
|
echo "<fc=$color> $volume</fc>"
|
||||||
|
|
||||||
echo "<fc=$color>${mpcvolume:7:10}</fc> <fc=#ebdbb2>-</fc> <fc=$color>$volume</fc>"
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
|
Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
|
||||||
, bgColor = "#282828"
|
, bgColor = "#282828"
|
||||||
, fgColor = "#ebdbb2"
|
, fgColor = "#ebdbb2"
|
||||||
, position = Static {xpos = 0, ypos = 0, width = 2560, height = 20}
|
, position = Static {xpos = 2560, ypos = 0, width = 2560, height = 20}
|
||||||
, iconRoot = "X"
|
, iconRoot = "X"
|
||||||
, allDesktops = False
|
, allDesktops = True
|
||||||
, commands = [ Run Cpu ["-t", " <fc=#fb4934><total></fc>%","-H", "2"] 10
|
, commands = [ Run Cpu ["-t", " <fc=#fb4934><total></fc>%","-H", "2"] 10
|
||||||
, Run Memory ["-t", "<fc=#fb4934><usedratio></fc>%"] 10
|
, Run Memory ["-t", "<fc=#fb4934><usedratio></fc>%"] 10
|
||||||
, Run Network "enp4s0" [ "-t", "<fc=#fb4934><tx></fc>kb/<fc=#fb4934><rx></fc>kb" ] 10
|
, Run Network "enp4s0" [ "-t", "<fc=#fb4934><tx></fc>kb/<fc=#fb4934><rx></fc>kb" ] 10
|
||||||
@ -15,5 +15,5 @@ Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true
|
|||||||
]
|
]
|
||||||
, sepChar = "%"
|
, sepChar = "%"
|
||||||
, alignSep = "}{"
|
, alignSep = "}{"
|
||||||
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% | %mouse_battery% | %volume% | 閭%cpu% | %memory% |%gamemode% "
|
, template = " <fc=#fb4934>%StdinReader%</fc>}%date%{%enp4s0% | %mouse_battery% | %volume% | 閭%cpu% | %memory% |%gamemode% "
|
||||||
}
|
}
|
||||||
|
2
.xinitrc
2
.xinitrc
@ -1 +1,3 @@
|
|||||||
|
[ -f "/home/tstarr/.ghcup/env" ] && source "/home/tstarr/.ghcup/env"
|
||||||
exec dbus-launch xmonad
|
exec dbus-launch xmonad
|
||||||
|
#exec qtile start
|
||||||
|
@ -1,143 +1,109 @@
|
|||||||
-- Base
|
-- Base
|
||||||
import XMonad
|
import XMonad hiding (Tall(..))
|
||||||
import Data.Monoid
|
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import System.IO
|
import System.IO
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import qualified Data.Map as M
|
|
||||||
import System.Directory (getHomeDirectory)
|
import System.Directory (getHomeDirectory)
|
||||||
|
import Data.Semigroup
|
||||||
-- Hooks
|
-- Hooks
|
||||||
import XMonad.Hooks.EwmhDesktops
|
import XMonad.Hooks.EwmhDesktops
|
||||||
import XMonad.Hooks.ManageDocks
|
import XMonad.Hooks.ManageDocks
|
||||||
import XMonad.Hooks.ManageHelpers
|
import XMonad.Hooks.ManageHelpers
|
||||||
import XMonad.Hooks.WorkspaceHistory
|
import XMonad.Hooks.WorkspaceHistory
|
||||||
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
||||||
|
import XMonad.Hooks.DynamicProperty
|
||||||
-- Layouts
|
-- Layouts
|
||||||
import XMonad.Layout.NoBorders
|
import XMonad.Layout.NoBorders
|
||||||
import XMonad.Layout.Gaps
|
|
||||||
import XMonad.Layout.Spacing
|
import XMonad.Layout.Spacing
|
||||||
import XMonad.Layout.ThreeColumns
|
|
||||||
import XMonad.Layout.Tabbed
|
import XMonad.Layout.Tabbed
|
||||||
import XMonad.Layout.Renamed
|
|
||||||
import XMonad.Layout.LayoutModifier
|
|
||||||
import XMonad.Layout.Combo
|
|
||||||
import XMonad.Layout.TwoPane
|
|
||||||
import XMonad.Layout.WindowNavigation
|
import XMonad.Layout.WindowNavigation
|
||||||
|
import XMonad.Layout.SimpleFloat
|
||||||
-- Utilities
|
import XMonad.Layout.HintedTile
|
||||||
import XMonad.Util.Run (runProcessWithInput, safeSpawn, spawnPipe)
|
--Utilities
|
||||||
|
import XMonad.Util.Run (spawnPipe)
|
||||||
import XMonad.Util.SpawnOnce
|
import XMonad.Util.SpawnOnce
|
||||||
import XMonad.Util.NamedScratchpad
|
|
||||||
import XMonad.Util.EZConfig (additionalKeysP, removeKeys)
|
import XMonad.Util.EZConfig (additionalKeysP, removeKeys)
|
||||||
import XMonad.Util.NamedActions
|
|
||||||
import XMonad.Util.NamedScratchpad
|
import XMonad.Util.NamedScratchpad
|
||||||
import XMonad.Util.NamedWindows (getName)
|
|
||||||
|
|
||||||
-- Actions
|
-- Actions
|
||||||
import XMonad.Actions.CycleWS (moveTo, shiftTo, WSType(..), nextScreen, prevScreen)
|
import XMonad.Actions.DynamicProjects (Project (..), dynamicProjects, switchProjectPrompt, shiftToProjectPrompt, switchProject, shiftToProject)
|
||||||
import XMonad.Actions.DynamicProjects
|
import XMonad.Actions.UpdatePointer
|
||||||
import XMonad.Actions.DynamicWorkspaces
|
import XMonad.Actions.Navigation2D
|
||||||
import XMonad.Actions.CopyWindow
|
|
||||||
import XMonad.Actions.Commands
|
|
||||||
|
|
||||||
-- Prompt
|
-- Prompt
|
||||||
import XMonad.Prompt
|
import XMonad.Prompt
|
||||||
|
|
||||||
-- Data
|
|
||||||
import Data.Maybe (isJust)
|
|
||||||
|
|
||||||
-- Terminal to use
|
-- Terminal to use
|
||||||
myTerminal = "alacritty"
|
myTerminal :: String
|
||||||
|
myTerminal = "alacritty"
|
||||||
-- Focus follows mouse pointer
|
-- Focus follows mouse pointer
|
||||||
myFocusFollowsMouse :: Bool
|
myFocusFollowsMouse :: Bool
|
||||||
myFocusFollowsMouse = True
|
myFocusFollowsMouse = True
|
||||||
|
|
||||||
-- Define mod keys
|
-- Define mod keys
|
||||||
|
myModMask :: KeyMask
|
||||||
myModMask = mod4Mask
|
myModMask = mod4Mask
|
||||||
altMask = mod1Mask
|
|
||||||
|
|
||||||
-- Define volume keys and commands
|
-- Define volume keys and commands
|
||||||
lowerVolumeCmd = "pulseaudio-ctl down 2"
|
lowerVolumeCmd = "pulseaudio-ctl down 2"
|
||||||
raiseVolumeCmd = "pulseaudio-ctl up 2"
|
raiseVolumeCmd = "pulseaudio-ctl up 2"
|
||||||
muteVolumeCmd = "pulseaudio-ctl mute"
|
muteVolumeCmd = "pulseaudio-ctl mute"
|
||||||
|
|
||||||
-- Count windows
|
-- Count windows
|
||||||
windowCount :: X (Maybe String)
|
windowCount :: X (Maybe String)
|
||||||
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
||||||
|
|
||||||
-- Define workspaces
|
-- Define workspaces
|
||||||
myWorkspaces = ["1","2","3","4","5","6","7","8","9"]
|
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||||
|
|
||||||
-- Width of window border
|
-- Width of window border
|
||||||
myBorderWidth = 2
|
myBorderWidth = 2
|
||||||
|
|
||||||
-- Border colors
|
-- Border colors
|
||||||
myNormalBorderColor = "#ebdbb2"
|
myNormalBorderColor = "#ebdbb2"
|
||||||
myFocusedBorderColor = "#d3869b"
|
myFocusedBorderColor = "#d3869b"
|
||||||
|
-- Configuration for myNav2D
|
||||||
-- Prompt theming
|
myNav2DConf = def
|
||||||
myFont = "xft:Mononoki Nerd Font:bold:size=9:antialias=true:hinting=true"
|
{ defaultTiledNavigation = centerNavigation
|
||||||
yellow = "#504945"
|
, floatNavigation = centerNavigation
|
||||||
base03 = "#ebdbb2"
|
, screenNavigation = lineNavigation
|
||||||
active = "#b8bb26"
|
, layoutNavigation = [("Spacing Full", centerNavigation)]
|
||||||
prompt = 20
|
, unmappedWindowRect = [("Spacing Full", singleWindowRect)]
|
||||||
|
|
||||||
myPromptTheme = def
|
|
||||||
{ font = myFont
|
|
||||||
, bgColor = base03
|
|
||||||
, fgColor = active
|
|
||||||
, fgHLight = base03
|
|
||||||
, bgHLight = active
|
|
||||||
, borderColor = base03
|
|
||||||
, promptBorderWidth = 0
|
|
||||||
, height = prompt
|
|
||||||
, position = Top
|
|
||||||
}
|
}
|
||||||
|
|
||||||
myStartupHook = do
|
myStartupHook = do
|
||||||
spawnOnce "nitrogen --restore &"
|
spawnOnce "nitrogen --restore &"
|
||||||
spawnOnce "lxsession &"
|
spawnOnce "lxsession &"
|
||||||
spawnOnce "xsetroot -cursor_name left_ptr"
|
spawnOnce "xsetroot -cursor_name left_ptr"
|
||||||
|
spawnOnce "xmodmap ~/.config/xmodmap/Xmodmap"
|
||||||
spawnOnce "imwheel -b 45 &"
|
spawnOnce "imwheel -b 45 &"
|
||||||
spawnOnce "play-with-mpv &"
|
spawnOnce "play-with-mpv &"
|
||||||
|
spawnOnce "udiskie &"
|
||||||
|
spawnOnce "dunst -conf ~/.config/dunst/dunstrc"
|
||||||
|
|
||||||
------------------------------------------------------------------------}}}
|
projects :: [Project]
|
||||||
-- Layouts {{{
|
projects =
|
||||||
--
|
[ Project { projectName = "dev"
|
||||||
-- Alot stolen from https://github.com/altercation/dotfiles-tilingwm
|
, projectDirectory = "~/devel"
|
||||||
---------------------------------------------------------------------------
|
, projectStartHook = Just $ do spawn "emacs"
|
||||||
|
spawn myTerminal
|
||||||
|
},
|
||||||
|
Project { projectName = "game"
|
||||||
|
, projectDirectory = "~/"
|
||||||
|
, projectStartHook = Nothing
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled ||| Mirror tiled ||| Full ||| ThreeColMid 1 (3/100) (1/2) ||| tabTwoPane)
|
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled Tall ||| tiled Wide ||| Full ||| simpleFloat)
|
||||||
where
|
where
|
||||||
-- default tiling algorithm partitions the screen into two panes
|
-- default tiling algorithm partitions the screen into two panes
|
||||||
tiled = Tall nmaster delta ratio
|
--tiled = Tall nmaster delta ratio
|
||||||
|
tiled = HintedTile 1 0.03 0.5 TopLeft
|
||||||
-- The default number of windows in the master pane
|
-- The default number of windows in the master pane
|
||||||
nmaster = 1
|
--nmaster = 1
|
||||||
-- Default proportion of screen occupied by master pane
|
-- Default proportion of screen occupied by master pane
|
||||||
ratio = 1/2
|
--ratio = 1/2
|
||||||
-- Percent of screen to increment by when resizing panes
|
-- Percent of screen to increment by when resizing panes
|
||||||
delta = 2/100
|
--delta = 2/100
|
||||||
|
|
||||||
tabTwoPane = renamed [Replace "TwoPane Tabs"] $ combineTwo (TwoPane 0.03 0.5) (tabs) (tabs)
|
|
||||||
|
|
||||||
tabs = tabbed shrinkText myTabTheme
|
|
||||||
|
|
||||||
myTabTheme = def { fontName = myFont
|
|
||||||
, activeColor = "#46d9ff"
|
|
||||||
, inactiveColor = "#313846"
|
|
||||||
, activeBorderColor = "#46d9ff"
|
|
||||||
, inactiveBorderColor = "#282c34"
|
|
||||||
, activeTextColor = "#282c34"
|
|
||||||
, inactiveTextColor = "#d0d0d0"
|
|
||||||
}
|
|
||||||
|
|
||||||
myScratchPads :: [NamedScratchpad]
|
myScratchPads :: [NamedScratchpad]
|
||||||
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
||||||
, NS "scr-mpv" spawnMpv findMpv manageMpv
|
, NS "discord" spawnDiscord findDiscord manageDiscord
|
||||||
, NS "discord" spawnDiscord findDiscord manageDiscord ]
|
, NS "keepassxc" spawnKeepass findKeepass manageKeepass
|
||||||
|
, NS "gsimplecal" spawnCal findCal manageCal
|
||||||
|
, NS "scratch-emacs" spawnEmacs findEmacs manageEmacs ]
|
||||||
where
|
where
|
||||||
spawnTerm = myTerminal ++ " -t terminal"
|
spawnTerm = myTerminal ++ " -t terminal"
|
||||||
findTerm = title =? "terminal"
|
findTerm = title =? "terminal"
|
||||||
@ -148,15 +114,6 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
|||||||
t = 0.95 -h
|
t = 0.95 -h
|
||||||
l = 0.95 -w
|
l = 0.95 -w
|
||||||
|
|
||||||
spawnMpv = "mpv --player-operation-mode=pseudo-gui --title=scr-mpv"
|
|
||||||
findMpv = title =? "scr-mpv"
|
|
||||||
manageMpv = customFloating $ W.RationalRect l t w h
|
|
||||||
where
|
|
||||||
h = 0.9
|
|
||||||
w = 0.9
|
|
||||||
t = 0.95 -h
|
|
||||||
l = 0.95 -w
|
|
||||||
|
|
||||||
spawnDiscord = "discord"
|
spawnDiscord = "discord"
|
||||||
findDiscord = appName =? "discord"
|
findDiscord = appName =? "discord"
|
||||||
manageDiscord = customFloating $ W.RationalRect l t w h
|
manageDiscord = customFloating $ W.RationalRect l t w h
|
||||||
@ -166,20 +123,48 @@ myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
|||||||
t = 0.95 -h
|
t = 0.95 -h
|
||||||
l = 0.95 -w
|
l = 0.95 -w
|
||||||
|
|
||||||
|
spawnKeepass = "keepassxc"
|
||||||
|
findKeepass = appName =? "keepassxc"
|
||||||
|
manageKeepass = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
spawnCal = "gsimplecal"
|
||||||
|
findCal = appName =? "gsimplecal"
|
||||||
|
manageCal = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.125
|
||||||
|
w = 0.1
|
||||||
|
t = 0.15 -h
|
||||||
|
l = 0.55 -w
|
||||||
|
|
||||||
|
spawnEmacs = "emacs --eval '(set-frame-name \"scratch-emacs\")'"
|
||||||
|
findEmacs = title =? "scratch-emacs"
|
||||||
|
manageEmacs = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
-- Set default display modes for applications
|
||||||
myManageHook = composeAll
|
myManageHook = composeAll
|
||||||
-- Float fullscreen apps (mostly games)
|
-- Float fullscreen apps (mostly games)
|
||||||
[isDialog --> doCenterFloat,
|
[isDialog --> doCenterFloat,
|
||||||
isFullscreen --> doFullFloat,
|
isFullscreen --> doFullFloat,
|
||||||
className =? "Gimp" --> doFullFloat,
|
className =? "Gimp" --> doFullFloat,
|
||||||
className =? "Anki" --> doFullFloat,
|
|
||||||
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
|
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
|
||||||
className =? "Steam" --> doFullFloat,
|
className =? "Steam" --> doFullFloat,
|
||||||
className =? "microsoft teams - preview" --> doFullFloat,
|
|
||||||
namedScratchpadManageHook myScratchPads]
|
namedScratchpadManageHook myScratchPads]
|
||||||
|
-- Set dynamic display modes
|
||||||
myEventHook = mempty
|
myEventHook :: Event -> X All
|
||||||
|
myEventHook = dynamicPropertyChange "WM_NAME" (title =? "scratch-emacs" --> floating)
|
||||||
myLogHook = return ()
|
where floating = customFloating $ W.RationalRect (1/6) 0.05 (2/3) 0.9
|
||||||
|
-- Log hook
|
||||||
|
myLogHook = updatePointer (0.5, 0.5) (0, 0)
|
||||||
|
|
||||||
myKeys :: String -> [([Char], X ())]
|
myKeys :: String -> [([Char], X ())]
|
||||||
myKeys home =
|
myKeys home =
|
||||||
@ -189,28 +174,10 @@ myKeys home =
|
|||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Rotate through the available layout algorithms
|
-- Rotate through the available layout algorithms
|
||||||
("M-<Tab>", sendMessage NextLayout)
|
("M-<Tab>", sendMessage NextLayout)
|
||||||
-- Move focus to the next window
|
|
||||||
, ("M-j", windows W.focusDown)
|
|
||||||
-- Move focus to the previous window
|
|
||||||
, ("M-k", windows W.focusUp)
|
|
||||||
-- Switch focus to next monitor
|
|
||||||
, ("M-.", nextScreen)
|
|
||||||
-- Switch focus to prev monitor
|
|
||||||
, ("M-,", prevScreen)
|
|
||||||
-- Swap the focused window with the next window/tabs
|
|
||||||
, ("M-S-j", sequence_ [windows W.swapDown, sendMessage $ Move R])
|
|
||||||
-- Swap the focused window with the previous window/tabs
|
|
||||||
, ("M-S-k", sequence_ [windows W.swapUp, sendMessage $ Move L])
|
|
||||||
-- Move focus to the master window
|
|
||||||
, ("M-m", windows W.focusMaster)
|
|
||||||
-- Swap the focused window and the master window
|
|
||||||
, ("M-c", windows W.swapMaster)
|
|
||||||
-- Shrink the master area
|
-- Shrink the master area
|
||||||
, ("M-h", sendMessage Shrink)
|
, ("M-C-h", sendMessage Shrink)
|
||||||
-- Expand the master area
|
-- Expand the master area
|
||||||
, ("M-l", sendMessage Expand)
|
, ("M-C-l", sendMessage Expand)
|
||||||
-- Copy window to all workspaces
|
|
||||||
, ("M-x c", toggleCopyToAll)
|
|
||||||
-- Push window back into tiling
|
-- Push window back into tiling
|
||||||
, ("M-t", withFocused $ windows . W.sink)
|
, ("M-t", withFocused $ windows . W.sink)
|
||||||
-- close focused window
|
-- close focused window
|
||||||
@ -220,21 +187,33 @@ myKeys home =
|
|||||||
-- Basic Utils
|
-- Basic Utils
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Spawn terminal
|
-- Spawn terminal
|
||||||
|
|
||||||
, ("M-<Return>" , spawn "alacritty")
|
, ("M-<Return>" , spawn "alacritty")
|
||||||
-- Spawn rofi drun
|
-- Spawn rofi drun
|
||||||
, ("M-w" , spawn "rofi -show drun")
|
, ("M-w" , spawn "rofi -show run -theme gruvbox-dark-soft")
|
||||||
-- Spawn rofi window
|
|
||||||
, ("M-S-w", spawn "rofi -show window")
|
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Scratchpads
|
-- Scratchpads
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Spawn rofi window
|
|
||||||
|
-- Spawn terminal scratchpad
|
||||||
, ("M-S-<Return>", namedScratchpadAction myScratchPads "terminal")
|
, ("M-S-<Return>", namedScratchpadAction myScratchPads "terminal")
|
||||||
-- Spawn rofi window
|
-- Spawn discord scratchpad
|
||||||
, ("M-d", namedScratchpadAction myScratchPads "discord")
|
, ("M-d", namedScratchpadAction myScratchPads "discord")
|
||||||
-- Spawn rofi window
|
-- Spawn keepass scratchpad
|
||||||
, ("M-v", namedScratchpadAction myScratchPads "scr-mpv")
|
, ("M-m", namedScratchpadAction myScratchPads "keepassxc")
|
||||||
|
-- Spawn calendar scratchpad
|
||||||
|
, ("M-c", namedScratchpadAction myScratchPads "gsimplecal")
|
||||||
|
-- Spawn emacs scratchpad
|
||||||
|
, ("M-e", namedScratchpadAction myScratchPads "scratch-emacs")
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Dynamic Projects
|
||||||
|
--------------------------------------------------
|
||||||
|
, ("M-p d", switchProject (projects !! 0))
|
||||||
|
, ("M-p S-d", shiftToProject (projects !! 0))
|
||||||
|
, ("M-p g", switchProject (projects !! 1))
|
||||||
|
, ("M-p S-g", shiftToProject (projects !! 1))
|
||||||
|
|
||||||
--------------------------------------------------
|
--------------------------------------------------
|
||||||
-- Open Applications
|
-- Open Applications
|
||||||
@ -268,15 +247,10 @@ myKeys home =
|
|||||||
-- lower overall volume
|
-- lower overall volume
|
||||||
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
|
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
|
||||||
]
|
]
|
||||||
where
|
-- Remove the default binding for quit xmonad
|
||||||
toggleCopyToAll = wsContainingCopies >>= \ws -> case ws of
|
|
||||||
[] -> windows copyToAll
|
|
||||||
_ -> killAllOtherCopies
|
|
||||||
|
|
||||||
rmKeys :: String -> [(KeyMask, KeySym)]
|
rmKeys :: String -> [(KeyMask, KeySym)]
|
||||||
rmKeys keys =
|
rmKeys keys =
|
||||||
[
|
[
|
||||||
-- Remove the default quit xmonad bind
|
|
||||||
(myModMask .|. shiftMask, xK_q)
|
(myModMask .|. shiftMask, xK_q)
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -284,7 +258,21 @@ main = do
|
|||||||
home <- getHomeDirectory
|
home <- getHomeDirectory
|
||||||
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
|
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
|
||||||
--
|
--
|
||||||
xmonad $ docks $ ewmh $ ewmhFullscreen def
|
xmonad
|
||||||
|
$ dynamicProjects projects
|
||||||
|
$ docks
|
||||||
|
$ ewmhFullscreen
|
||||||
|
$ withNavigation2DConfig myNav2DConf
|
||||||
|
$ navigation2DP def
|
||||||
|
("k", "h", "j", "l")
|
||||||
|
[("M-", windowGo),
|
||||||
|
("M-S-", windowSwap)]
|
||||||
|
False
|
||||||
|
$ additionalNav2DKeysP ("", ",", "", ".")
|
||||||
|
[("M-", screenGo),
|
||||||
|
("M-S-", screenSwap)]
|
||||||
|
False
|
||||||
|
$ def
|
||||||
{
|
{
|
||||||
-- Simple items
|
-- Simple items
|
||||||
terminal = myTerminal,
|
terminal = myTerminal,
|
||||||
@ -301,14 +289,14 @@ main = do
|
|||||||
handleEventHook = myEventHook,
|
handleEventHook = myEventHook,
|
||||||
logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
|
logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
|
||||||
{ ppOutput = \x -> hPutStrLn xmproc0 x
|
{ ppOutput = \x -> hPutStrLn xmproc0 x
|
||||||
, ppCurrent = xmobarColor "#b8bb26" "" . wrap "[" "]" -- Current workspace in xmobar
|
, ppCurrent = xmobarColor "#b8bb26" "" . wrap "[" "]" -- Current workspace in xmobar
|
||||||
, ppVisible = xmobarColor "#83a598" "" -- Visible but not current workspace
|
, ppVisible = xmobarColor "#83a598" "" -- Visible but not current workspace
|
||||||
, ppHidden = xmobarColor "#83a598" "" . wrap "*" "" -- Hidden workspaces in xmobar
|
, ppHidden = xmobarColor "#83a598" "" . wrap "*" "" -- Hidden workspaces in xmobar
|
||||||
, ppHiddenNoWindows= \( _ ) -> "" -- Only shows visible workspaces. Useful for TreeSelect.
|
, ppHiddenNoWindows= \( _ ) -> "" -- Only shows visible workspaces. Useful for TreeSelect.
|
||||||
, ppTitle = xmobarColor "#ebdbb2" "" . shorten 60 -- Title of active window in xmobar
|
, ppTitle = xmobarColor "#ebdbb2" "" . shorten 60 -- Title of active window in xmobar
|
||||||
, ppSep = "<fc=#ebdbb2> | </fc>" -- Separators in xmobar
|
, ppSep = "<fc=#ebdbb2> | </fc>" -- Separators in xmobar
|
||||||
, ppUrgent = xmobarColor "#fb4934" "" . wrap "!" "!" -- Urgent workspace
|
, ppUrgent = xmobarColor "#fb4934" "" . wrap "!" "!" -- Urgent workspace
|
||||||
, ppExtras = [windowCount] -- # of windows current workspace
|
, ppExtras = [windowCount] -- # of windows current workspace
|
||||||
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]},
|
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]},
|
||||||
startupHook = myStartupHook
|
startupHook = myStartupHook
|
||||||
} `removeKeys` rmKeys home
|
} `removeKeys` rmKeys home
|
||||||
|
347
.xmonad/xmonad.org
Normal file
347
.xmonad/xmonad.org
Normal file
@ -0,0 +1,347 @@
|
|||||||
|
#+title: Xmomad - Personal Xmonad Config
|
||||||
|
#+author: Tyler Starr
|
||||||
|
#+email: tyler@tstarr.us
|
||||||
|
#+keywords: config xmonad haskell wm
|
||||||
|
* References
|
||||||
|
* Configuration
|
||||||
|
** Imports
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
-- Base
|
||||||
|
import XMonad hiding (Tall(..))
|
||||||
|
import System.Exit
|
||||||
|
import System.IO
|
||||||
|
import qualified XMonad.StackSet as W
|
||||||
|
import System.Directory (getHomeDirectory)
|
||||||
|
import Data.Semigroup
|
||||||
|
-- Hooks
|
||||||
|
import XMonad.Hooks.EwmhDesktops
|
||||||
|
import XMonad.Hooks.ManageDocks
|
||||||
|
import XMonad.Hooks.ManageHelpers
|
||||||
|
import XMonad.Hooks.WorkspaceHistory
|
||||||
|
import XMonad.Hooks.DynamicLog (dynamicLogWithPP, wrap, xmobarPP, xmobarColor, shorten, PP(..))
|
||||||
|
import XMonad.Hooks.DynamicProperty
|
||||||
|
-- Layouts
|
||||||
|
import XMonad.Layout.NoBorders
|
||||||
|
import XMonad.Layout.Spacing
|
||||||
|
import XMonad.Layout.Tabbed
|
||||||
|
import XMonad.Layout.WindowNavigation
|
||||||
|
import XMonad.Layout.SimpleFloat
|
||||||
|
import XMonad.Layout.HintedTile
|
||||||
|
--Utilities
|
||||||
|
import XMonad.Util.Run (spawnPipe)
|
||||||
|
import XMonad.Util.SpawnOnce
|
||||||
|
import XMonad.Util.EZConfig (additionalKeysP, removeKeys)
|
||||||
|
import XMonad.Util.NamedScratchpad
|
||||||
|
-- Actions
|
||||||
|
import XMonad.Actions.DynamicProjects (Project (..), dynamicProjects, switchProjectPrompt, shiftToProjectPrompt, switchProject, shiftToProject)
|
||||||
|
import XMonad.Actions.UpdatePointer
|
||||||
|
import XMonad.Actions.Navigation2D
|
||||||
|
-- Prompt
|
||||||
|
import XMonad.Prompt
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Variables
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
-- Terminal to use
|
||||||
|
myTerminal :: String
|
||||||
|
myTerminal = "alacritty"
|
||||||
|
-- Focus follows mouse pointer
|
||||||
|
myFocusFollowsMouse :: Bool
|
||||||
|
myFocusFollowsMouse = True
|
||||||
|
-- Define mod keys
|
||||||
|
myModMask :: KeyMask
|
||||||
|
myModMask = mod4Mask
|
||||||
|
-- Define volume keys and commands
|
||||||
|
lowerVolumeCmd = "pulseaudio-ctl down 2"
|
||||||
|
raiseVolumeCmd = "pulseaudio-ctl up 2"
|
||||||
|
muteVolumeCmd = "pulseaudio-ctl mute"
|
||||||
|
-- Count windows
|
||||||
|
windowCount :: X (Maybe String)
|
||||||
|
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
||||||
|
-- Define workspaces
|
||||||
|
myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
|
||||||
|
-- Width of window border
|
||||||
|
myBorderWidth = 2
|
||||||
|
-- Border colors
|
||||||
|
myNormalBorderColor = "#ebdbb2"
|
||||||
|
myFocusedBorderColor = "#d3869b"
|
||||||
|
-- Configuration for myNav2D
|
||||||
|
myNav2DConf = def
|
||||||
|
{ defaultTiledNavigation = centerNavigation
|
||||||
|
, floatNavigation = centerNavigation
|
||||||
|
, screenNavigation = lineNavigation
|
||||||
|
, layoutNavigation = [("Spacing Full", centerNavigation)]
|
||||||
|
, unmappedWindowRect = [("Spacing Full", singleWindowRect)]
|
||||||
|
}
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Startup
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
myStartupHook = do
|
||||||
|
spawnOnce "nitrogen --restore &"
|
||||||
|
spawnOnce "lxsession &"
|
||||||
|
spawnOnce "xsetroot -cursor_name left_ptr"
|
||||||
|
spawnOnce "xmodmap ~/.config/xmodmap/Xmodmap"
|
||||||
|
spawnOnce "imwheel -b 45 &"
|
||||||
|
spawnOnce "play-with-mpv &"
|
||||||
|
spawnOnce "udiskie &"
|
||||||
|
spawnOnce "dunst -conf ~/.config/dunst/dunstrc"
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Projects
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
projects :: [Project]
|
||||||
|
projects =
|
||||||
|
[ Project { projectName = "dev"
|
||||||
|
, projectDirectory = "~/devel"
|
||||||
|
, projectStartHook = Just $ do spawn "emacs"
|
||||||
|
spawn myTerminal
|
||||||
|
},
|
||||||
|
Project { projectName = "game"
|
||||||
|
, projectDirectory = "~/"
|
||||||
|
, projectStartHook = Nothing
|
||||||
|
}
|
||||||
|
]
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Layout
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled Tall ||| tiled Wide ||| Full ||| simpleFloat)
|
||||||
|
where
|
||||||
|
-- default tiling algorithm partitions the screen into two panes
|
||||||
|
--tiled = Tall nmaster delta ratio
|
||||||
|
tiled = HintedTile 1 0.03 0.5 TopLeft
|
||||||
|
-- The default number of windows in the master pane
|
||||||
|
--nmaster = 1
|
||||||
|
-- Default proportion of screen occupied by master pane
|
||||||
|
--ratio = 1/2
|
||||||
|
-- Percent of screen to increment by when resizing panes
|
||||||
|
--delta = 2/100
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Scratchpads
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
myScratchPads :: [NamedScratchpad]
|
||||||
|
myScratchPads = [ NS "terminal" spawnTerm findTerm manageTerm
|
||||||
|
, NS "discord" spawnDiscord findDiscord manageDiscord
|
||||||
|
, NS "keepassxc" spawnKeepass findKeepass manageKeepass
|
||||||
|
, NS "gsimplecal" spawnCal findCal manageCal
|
||||||
|
, NS "scratch-emacs" spawnEmacs findEmacs manageEmacs ]
|
||||||
|
where
|
||||||
|
spawnTerm = myTerminal ++ " -t terminal"
|
||||||
|
findTerm = title =? "terminal"
|
||||||
|
manageTerm = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
spawnDiscord = "discord"
|
||||||
|
findDiscord = appName =? "discord"
|
||||||
|
manageDiscord = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
spawnKeepass = "keepassxc"
|
||||||
|
findKeepass = appName =? "keepassxc"
|
||||||
|
manageKeepass = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
|
||||||
|
spawnCal = "gsimplecal"
|
||||||
|
findCal = appName =? "gsimplecal"
|
||||||
|
manageCal = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.125
|
||||||
|
w = 0.1
|
||||||
|
t = 0.15 -h
|
||||||
|
l = 0.55 -w
|
||||||
|
|
||||||
|
spawnEmacs = "emacs --eval '(set-frame-name \"scratch-emacs\")'"
|
||||||
|
findEmacs = title =? "scratch-emacs"
|
||||||
|
manageEmacs = customFloating $ W.RationalRect l t w h
|
||||||
|
where
|
||||||
|
h = 0.9
|
||||||
|
w = 0.9
|
||||||
|
t = 0.95 -h
|
||||||
|
l = 0.95 -w
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Hooks
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
-- Set default display modes for applications
|
||||||
|
myManageHook = composeAll
|
||||||
|
-- Float fullscreen apps (mostly games)
|
||||||
|
[isDialog --> doCenterFloat,
|
||||||
|
isFullscreen --> doFullFloat,
|
||||||
|
className =? "Gimp" --> doFullFloat,
|
||||||
|
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
|
||||||
|
className =? "Steam" --> doFullFloat,
|
||||||
|
namedScratchpadManageHook myScratchPads]
|
||||||
|
-- Set dynamic display modes
|
||||||
|
myEventHook :: Event -> X All
|
||||||
|
myEventHook = dynamicPropertyChange "WM_NAME" (title =? "scratch-emacs" --> floating)
|
||||||
|
where floating = customFloating $ W.RationalRect (1/6) 0.05 (2/3) 0.9
|
||||||
|
-- Log hook
|
||||||
|
myLogHook = updatePointer (0.5, 0.5) (0, 0)
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Keybinds
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
myKeys :: String -> [([Char], X ())]
|
||||||
|
myKeys home =
|
||||||
|
[
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Window/Focus Manipulation
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Rotate through the available layout algorithms
|
||||||
|
("M-<Tab>", sendMessage NextLayout)
|
||||||
|
-- Shrink the master area
|
||||||
|
, ("M-C-h", sendMessage Shrink)
|
||||||
|
-- Expand the master area
|
||||||
|
, ("M-C-l", sendMessage Expand)
|
||||||
|
-- Push window back into tiling
|
||||||
|
, ("M-t", withFocused $ windows . W.sink)
|
||||||
|
-- close focused window
|
||||||
|
, ("M-q", kill)
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Basic Utils
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Spawn terminal
|
||||||
|
|
||||||
|
, ("M-<Return>" , spawn "alacritty")
|
||||||
|
-- Spawn rofi drun
|
||||||
|
, ("M-w" , spawn "rofi -show run -theme gruvbox-dark-soft")
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Scratchpads
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
-- Spawn terminal scratchpad
|
||||||
|
, ("M-S-<Return>", namedScratchpadAction myScratchPads "terminal")
|
||||||
|
-- Spawn discord scratchpad
|
||||||
|
, ("M-d", namedScratchpadAction myScratchPads "discord")
|
||||||
|
-- Spawn keepass scratchpad
|
||||||
|
, ("M-m", namedScratchpadAction myScratchPads "keepassxc")
|
||||||
|
-- Spawn calendar scratchpad
|
||||||
|
, ("M-c", namedScratchpadAction myScratchPads "gsimplecal")
|
||||||
|
-- Spawn emacs scratchpad
|
||||||
|
, ("M-e", namedScratchpadAction myScratchPads "scratch-emacs")
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Dynamic Projects
|
||||||
|
--------------------------------------------------
|
||||||
|
--, ("M-p s", switchProjectPrompt projectsTheme)
|
||||||
|
--, ("M-p S", shiftToProjectPrompt projectsTheme)
|
||||||
|
, ("M-p d", switchProject (projects !! 0))
|
||||||
|
, ("M-p S-d", shiftToProject (projects !! 0))
|
||||||
|
, ("M-p g", switchProject (projects !! 1))
|
||||||
|
, ("M-p S-g", shiftToProject (projects !! 1))
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Open Applications
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Spawn firefox
|
||||||
|
, ("M-o b" , spawn "brave")
|
||||||
|
-- Spawn lutris
|
||||||
|
, ("M-o l" , spawn "lutris")
|
||||||
|
-- Spawn steam
|
||||||
|
, ("M-o s" , spawn "steam")
|
||||||
|
-- Spawn flameshot
|
||||||
|
, ("M-o c" , spawn "flameshot gui")
|
||||||
|
-- Spawn emacs
|
||||||
|
, ("M-o e" , spawn "emacs")
|
||||||
|
|
||||||
|
--------------------------------------------------
|
||||||
|
-- System Utils
|
||||||
|
--------------------------------------------------
|
||||||
|
-- Recompile and restart xmonad
|
||||||
|
, ("M-x r", spawn "xmonad --recompile; xmonad --restart")
|
||||||
|
-- Quit xmonad
|
||||||
|
, ("M-x q", io (exitWith ExitSuccess))
|
||||||
|
-- Start gamemode
|
||||||
|
, ("M-x g", spawn "gamemoded -r")
|
||||||
|
-- Stop gamemode
|
||||||
|
, ("M-x S-g", spawn "killall gamemoded")
|
||||||
|
-- mute overall volume
|
||||||
|
, ("<XF86AudioMute>", spawn muteVolumeCmd)
|
||||||
|
-- raise overall volume
|
||||||
|
, ("<XF86AudioRaiseVolume>", spawn raiseVolumeCmd)
|
||||||
|
-- lower overall volume
|
||||||
|
, ("<XF86AudioLowerVolume>", spawn lowerVolumeCmd)
|
||||||
|
]
|
||||||
|
-- Remove the default binding for quit xmonad
|
||||||
|
rmKeys :: String -> [(KeyMask, KeySym)]
|
||||||
|
rmKeys keys =
|
||||||
|
[
|
||||||
|
(myModMask .|. shiftMask, xK_q)
|
||||||
|
]
|
||||||
|
#+end_src
|
||||||
|
|
||||||
|
** Main
|
||||||
|
|
||||||
|
#+begin_src haskell :tangle "xmonad.hs"
|
||||||
|
main = do
|
||||||
|
home <- getHomeDirectory
|
||||||
|
xmproc0 <- spawnPipe "xmobar -x 0 ~/.config/xmobar/xmobarrc"
|
||||||
|
--
|
||||||
|
xmonad
|
||||||
|
$ dynamicProjects projects
|
||||||
|
$ docks
|
||||||
|
$ ewmhFullscreen
|
||||||
|
$ withNavigation2DConfig myNav2DConf
|
||||||
|
$ navigation2DP def
|
||||||
|
("k", "h", "j", "l")
|
||||||
|
[("M-", windowGo),
|
||||||
|
("M-S-", windowSwap)]
|
||||||
|
False
|
||||||
|
$ additionalNav2DKeysP ("", ",", "", ".")
|
||||||
|
[("M-", screenGo),
|
||||||
|
("M-S-", screenSwap)]
|
||||||
|
False
|
||||||
|
$ def
|
||||||
|
{
|
||||||
|
-- Simple items
|
||||||
|
terminal = myTerminal,
|
||||||
|
focusFollowsMouse = myFocusFollowsMouse,
|
||||||
|
borderWidth = myBorderWidth,
|
||||||
|
modMask = myModMask,
|
||||||
|
workspaces = myWorkspaces,
|
||||||
|
normalBorderColor = myNormalBorderColor,
|
||||||
|
focusedBorderColor = myFocusedBorderColor,
|
||||||
|
|
||||||
|
-- Hooks, Layouts
|
||||||
|
layoutHook = avoidStruts $ myLayout,
|
||||||
|
manageHook = myManageHook,
|
||||||
|
handleEventHook = myEventHook,
|
||||||
|
logHook = workspaceHistoryHook <+> myLogHook <+> dynamicLogWithPP xmobarPP
|
||||||
|
{ ppOutput = \x -> hPutStrLn xmproc0 x
|
||||||
|
, ppCurrent = xmobarColor "#b8bb26" "" . wrap "[" "]" -- Current workspace in xmobar
|
||||||
|
, ppVisible = xmobarColor "#83a598" "" -- Visible but not current workspace
|
||||||
|
, ppHidden = xmobarColor "#83a598" "" . wrap "*" "" -- Hidden workspaces in xmobar
|
||||||
|
, ppHiddenNoWindows= \( _ ) -> "" -- Only shows visible workspaces. Useful for TreeSelect.
|
||||||
|
, ppTitle = xmobarColor "#ebdbb2" "" . shorten 60 -- Title of active window in xmobar
|
||||||
|
, ppSep = "<fc=#ebdbb2> | </fc>" -- Separators in xmobar
|
||||||
|
, ppUrgent = xmobarColor "#fb4934" "" . wrap "!" "!" -- Urgent workspace
|
||||||
|
, ppExtras = [windowCount] -- # of windows current workspace
|
||||||
|
, ppOrder = \(ws:l:t:ex) -> [ws,l]++ex++[t]},
|
||||||
|
startupHook = myStartupHook
|
||||||
|
} `removeKeys` rmKeys home
|
||||||
|
`additionalKeysP` myKeys home
|
||||||
|
#+end_src
|
Loading…
x
Reference in New Issue
Block a user