mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-18 18:57:32 -08:00
Many changes before working on scratch.
This commit is contained in:
parent
3deea4f9d5
commit
c51d2e9354
@ -1,6 +1,6 @@
|
||||
"""
|
||||
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
|
||||
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:
|
87
.config/qtile/custom/windowname.py
Normal file
87
.config/qtile/custom/windowname.py
Normal file
@ -0,0 +1,87 @@
|
||||
# Copyright (c) 2008, 2010 Aldo Cortesi
|
||||
# Copyright (c) 2010 matt
|
||||
# Copyright (c) 2011 Mounier Florian
|
||||
# Copyright (c) 2012 Tim Neumann
|
||||
# Copyright (c) 2013 Craig Barnes
|
||||
# Copyright (c) 2014 Sean Vig
|
||||
# Copyright (c) 2014 Tycho Andersen
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
from libqtile import bar, hook, pangocffi
|
||||
from libqtile.log_utils import logger
|
||||
from libqtile.widget import base
|
||||
|
||||
|
||||
class WindowName(base._TextBox):
|
||||
"""Displays the name of the window that currently has focus"""
|
||||
orientations = base.ORIENTATION_HORIZONTAL
|
||||
defaults = [
|
||||
('for_current_screen', False, 'instead of this bars screen use currently active screen'),
|
||||
('empty_group_string', ' ', 'string to display when no windows are focused on current group'),
|
||||
('format', '{state}{name}', 'format of the text'),
|
||||
('parse_text', None, 'Function to parse and modify window names. '
|
||||
'e.g. function in config that removes excess '
|
||||
'strings from window name: '
|
||||
'def my_func(text)'
|
||||
' for string in [\" - Chromium\", \" - Firefox\"]:'
|
||||
' text = text.replace(string, \"\")'
|
||||
' return text'
|
||||
'then set option parse_text=my_func'),
|
||||
]
|
||||
|
||||
def __init__(self, width=bar.STRETCH, **config):
|
||||
base._TextBox.__init__(self, width=width, **config)
|
||||
self.add_defaults(WindowName.defaults)
|
||||
|
||||
def _configure(self, qtile, bar):
|
||||
base._TextBox._configure(self, qtile, bar)
|
||||
hook.subscribe.client_name_updated(self.hook_response)
|
||||
hook.subscribe.focus_change(self.hook_response)
|
||||
hook.subscribe.float_change(self.hook_response)
|
||||
|
||||
@hook.subscribe.current_screen_change
|
||||
def on_screen_changed():
|
||||
if self.for_current_screen:
|
||||
self.hook_response()
|
||||
|
||||
def hook_response(self, *args):
|
||||
w = self.qtile.current_screen.group.current_window
|
||||
state = ''
|
||||
if w:
|
||||
if w.maximized:
|
||||
state = '[] '
|
||||
elif w.minimized:
|
||||
state = '_ '
|
||||
elif w.floating:
|
||||
state = 'V '
|
||||
var = {}
|
||||
var["state"] = state
|
||||
var["name"] = w.name
|
||||
if callable(self.parse_text):
|
||||
try:
|
||||
var["name"] = self.parse_text(var["name"])
|
||||
except: # noqa: E722
|
||||
logger.exception("parse_text function failed:")
|
||||
wm_class = w.get_wm_class()
|
||||
var["class"] = wm_class[0] if wm_class else ""
|
||||
unescaped = self.format.format(**var)
|
||||
else:
|
||||
unescaped = self.empty_group_string
|
||||
self.update(pangocffi.markup_escape_text(unescaped))
|
@ -1,7 +1,7 @@
|
||||
from libqtile.config import EzKey
|
||||
from libqtile.command import lazy
|
||||
from libqtile import qtile
|
||||
import settings.traverse as traverse
|
||||
from custom.traverse import *
|
||||
import os
|
||||
|
||||
# Set mod key to the "windows" key
|
||||
@ -35,10 +35,10 @@ keys = [EzKey(k[0], *k[1:]) for k in [
|
||||
|
||||
# ------ Movement ------ #
|
||||
# Navigate between windows
|
||||
("M-h", lazy.function(traverse.left)),
|
||||
("M-j", lazy.function(traverse.down)),
|
||||
("M-k", lazy.function(traverse.up)),
|
||||
("M-l", lazy.function(traverse.right)),
|
||||
("M-h", lazy.function(left)),
|
||||
("M-j", lazy.function(down)),
|
||||
("M-k", lazy.function(up)),
|
||||
("M-l", lazy.function(right)),
|
||||
# Switch windows
|
||||
("M-S-<space>", lazy.function(switch_screens)),
|
||||
# Switch focus between two screens
|
||||
@ -95,7 +95,7 @@ keys = [EzKey(k[0], *k[1:]) for k in [
|
||||
("M-s", lazy.spawn("flameshot gui")),
|
||||
# Gamemode
|
||||
("M-S-g", lazy.spawn('toggle_gamemode')),
|
||||
# Manage computer audio
|
||||
#Manage computer audio
|
||||
("<XF86AudioLowerVolume>",
|
||||
lazy.spawn("pactl set-sink-volume @DEFAULT_SINK@ -2%")),
|
||||
("<XF86AudioRaiseVolume>",
|
||||
|
@ -1,5 +1,5 @@
|
||||
from libqtile import layout
|
||||
from settings.wal import wal
|
||||
from custom.wal import wal
|
||||
from libqtile.config import Match
|
||||
|
||||
# Layout configs
|
||||
|
@ -4,9 +4,6 @@ from settings.widgets import primary_widgets
|
||||
|
||||
# Define the screens (and bars)
|
||||
screens = [
|
||||
Screen(),
|
||||
Screen(top=bar.Bar(widgets=primary_widgets, size=20)),
|
||||
Screen(top=bar.Bar([
|
||||
widget.GroupBox(),
|
||||
widget.WindowName()
|
||||
], 20),)
|
||||
]
|
||||
|
@ -1,5 +1,6 @@
|
||||
from libqtile import widget
|
||||
from settings.wal import wal
|
||||
from custom.windowname import WindowName
|
||||
from custom.wal import wal
|
||||
spacer_len = 3
|
||||
wal_color = wal["colors"]
|
||||
|
||||
@ -51,7 +52,8 @@ primary_widgets = [
|
||||
),
|
||||
# Window Name
|
||||
widget.Spacer(length=spacer_len),
|
||||
widget.WindowName(foreground=wal_color["color2"]),
|
||||
WindowName(foreground=wal_color["color2"]),
|
||||
#widget.WindowName(foreground=wal_color["color2"]),
|
||||
# System Tray
|
||||
widget.Systray(background=wal_color["color0"], padding=0),
|
||||
widget.Spacer(length=spacer_len, background=wal_color["color0"]),
|
||||
@ -79,7 +81,7 @@ primary_widgets = [
|
||||
background=wal_color["color2"],
|
||||
),
|
||||
widget.Net(
|
||||
interface="enp4s0",
|
||||
interface="enp3s0",
|
||||
format="{down} ↓↑ {up}",
|
||||
foreground=wal_color["color0"],
|
||||
background=wal_color["color1"],
|
||||
|
2931
.config/scratch/Scratch.org
Executable file
2931
.config/scratch/Scratch.org
Executable file
File diff suppressed because it is too large
Load Diff
4
.config/scratch/readme.md
Normal file
4
.config/scratch/readme.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Scatch
|
||||
> When Doom can't scratch the itch.
|
||||
|
||||
My personal config of [Emacs](https://www.gnu.org/software/emacs/). My config is written in a Literate style so checkout [Scratch.org](https://github.com/starr-dusT/scratch/Scratch.org).
|
@ -1,7 +1,7 @@
|
||||
Config { font = "xft:Mononoki Nerd Font:pixelsize=12:antialias=true:hinting=true"
|
||||
, bgColor = "#282828"
|
||||
, fgColor = "#ebdbb2"
|
||||
, position = Static {xpos = 0, ypos = 0, width = 2560, height = 20}
|
||||
, position = Static {xpos = 2560, ypos = 0, width = 2560, height = 20}
|
||||
, iconRoot = "X"
|
||||
, allDesktops = True
|
||||
, commands = [ Run Cpu ["-t", " <fc=#fb4934><total></fc>%","-H", "2"] 10
|
||||
|
@ -307,3 +307,95 @@
|
||||
(beancount-mode)
|
||||
(define-key beancount-mode-map (kbd "C-c F") #'ts/next-fixme)
|
||||
(define-key beancount-mode-map (kbd "C-c f") #'ts/next-fixme-replace)
|
||||
|
||||
(setq ts/exwm-enabled t)
|
||||
|
||||
(defun ts/update-screen-layout ()
|
||||
(interactive)
|
||||
(let ((layout-script "~/.doom.d/scripts/update-screens"))
|
||||
(message "Running screen layout script: %s" layout-script)
|
||||
(start-process-shell-command "xrandr" nil layout-script)))
|
||||
|
||||
(defun ts/set-wallpaper ()
|
||||
(interactive)
|
||||
(start-process-shell-command
|
||||
"feh" nil "feh --bg-scale /home/tstarr/media/pictures/wallpapers/random_wallpapers/halfdome-2560x1440.jpg"))
|
||||
|
||||
(defun ts/configure-desktop ()
|
||||
(interactive)
|
||||
;;(dw/run-xmodmap)
|
||||
(ts/update-screen-layout)
|
||||
(ts/set-wallpaper))
|
||||
;;(run-at-time "2 sec" nil (lambda () (dw/update-wallpapers))))
|
||||
|
||||
|
||||
(when ts/exwm-enabled
|
||||
(set-frame-parameter (selected-frame) 'alpha '(95 . 95))
|
||||
(add-to-list 'default-frame-alist '(alpha . (95 . 95))))
|
||||
|
||||
(defun ts/on-exwm-init ()
|
||||
(ts/configure-desktop))
|
||||
|
||||
(when ts/exwm-enabled
|
||||
;; Configure the desktop for first load
|
||||
(add-hook 'exwm-init-hook #'ts/on-exwm-init))
|
||||
|
||||
;; Enable exwm-randr before exwm-init gets called
|
||||
(require 'exwm-randr)
|
||||
(exwm-randr-enable)
|
||||
|
||||
;; Set the default number of workspaces
|
||||
(setq exwm-workspace-number 5)
|
||||
|
||||
(defun efs/exwm-update-class ()
|
||||
(exwm-workspace-rename-buffer exwm-class-name))
|
||||
;; When window "class" updates, use it to set the buffer name
|
||||
(add-hook 'exwm-update-class-hook #'efs/exwm-update-class)
|
||||
|
||||
;; These keys should always pass through to Emacs
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x
|
||||
?\C-u
|
||||
?\C-h
|
||||
?\M-x
|
||||
?\M-`
|
||||
?\M-&
|
||||
?\M-:
|
||||
?\C-w
|
||||
?\C-\M-j ;; Buffer list
|
||||
?\C-\ )) ;; Ctrl+Space
|
||||
|
||||
;; Ctrl+Q will enable the next key to be sent directly
|
||||
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
|
||||
|
||||
;; Set up global key bindings. These always work, no matter the input state!
|
||||
;; Keep in mind that changing this list after EXWM initializes has no effect.
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
|
||||
([?\s-r] . exwm-reset)
|
||||
|
||||
;; Move between windows
|
||||
([s-left] . windmove-left)
|
||||
([s-right] . windmove-right)
|
||||
([s-up] . windmove-up)
|
||||
([s-down] . windmove-down)
|
||||
|
||||
;; Launch applications via shell command
|
||||
([?\s-o] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
|
||||
;; Switch workspace
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
|
||||
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))))
|
||||
|
||||
(setq exwm-randr-workspace-monitor-plist '(2 "HDMI-0" 4 "HDMI-0"))
|
||||
(exwm-enable)
|
||||
|
@ -375,6 +375,10 @@ We start by simply defining the standard headers used by the three files. These
|
||||
|
||||
(package! org-chef)
|
||||
|
||||
(package! simple-httpd)
|
||||
|
||||
(package! exwm)
|
||||
|
||||
#+end_src
|
||||
|
||||
* General Configuration
|
||||
@ -736,3 +740,99 @@ Following config items will utilizes the awesome [[https://github.com/alphapapa/
|
||||
(define-key beancount-mode-map (kbd "C-c F") #'ts/next-fixme)
|
||||
(define-key beancount-mode-map (kbd "C-c f") #'ts/next-fixme-replace)
|
||||
#+end_src
|
||||
* Desktop
|
||||
#+begin_src emacs-lisp :tangle (if (member this-system all-systems) "config.el" "no")
|
||||
|
||||
(setq ts/exwm-enabled t)
|
||||
|
||||
(defun ts/update-screen-layout ()
|
||||
(interactive)
|
||||
(let ((layout-script "~/.doom.d/scripts/update-screens"))
|
||||
(message "Running screen layout script: %s" layout-script)
|
||||
(start-process-shell-command "xrandr" nil layout-script)))
|
||||
|
||||
(defun ts/set-wallpaper ()
|
||||
(interactive)
|
||||
(start-process-shell-command
|
||||
"feh" nil "feh --bg-scale /home/tstarr/media/pictures/wallpapers/random_wallpapers/halfdome-2560x1440.jpg"))
|
||||
|
||||
(defun ts/configure-desktop ()
|
||||
(interactive)
|
||||
;;(dw/run-xmodmap)
|
||||
(ts/update-screen-layout)
|
||||
(ts/set-wallpaper))
|
||||
;;(run-at-time "2 sec" nil (lambda () (dw/update-wallpapers))))
|
||||
|
||||
|
||||
(when ts/exwm-enabled
|
||||
(set-frame-parameter (selected-frame) 'alpha '(95 . 95))
|
||||
(add-to-list 'default-frame-alist '(alpha . (95 . 95))))
|
||||
|
||||
(defun ts/on-exwm-init ()
|
||||
(ts/configure-desktop))
|
||||
|
||||
(when ts/exwm-enabled
|
||||
;; Configure the desktop for first load
|
||||
(add-hook 'exwm-init-hook #'ts/on-exwm-init))
|
||||
|
||||
;; Enable exwm-randr before exwm-init gets called
|
||||
(require 'exwm-randr)
|
||||
(exwm-randr-enable)
|
||||
|
||||
;; Set the default number of workspaces
|
||||
(setq exwm-workspace-number 5)
|
||||
|
||||
(defun efs/exwm-update-class ()
|
||||
(exwm-workspace-rename-buffer exwm-class-name))
|
||||
;; When window "class" updates, use it to set the buffer name
|
||||
(add-hook 'exwm-update-class-hook #'efs/exwm-update-class)
|
||||
|
||||
;; These keys should always pass through to Emacs
|
||||
(setq exwm-input-prefix-keys
|
||||
'(?\C-x
|
||||
?\C-u
|
||||
?\C-h
|
||||
?\M-x
|
||||
?\M-`
|
||||
?\M-&
|
||||
?\M-:
|
||||
?\C-w
|
||||
?\C-\M-j ;; Buffer list
|
||||
?\C-\ )) ;; Ctrl+Space
|
||||
|
||||
;; Ctrl+Q will enable the next key to be sent directly
|
||||
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
|
||||
|
||||
;; Set up global key bindings. These always work, no matter the input state!
|
||||
;; Keep in mind that changing this list after EXWM initializes has no effect.
|
||||
(setq exwm-input-global-keys
|
||||
`(
|
||||
;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard)
|
||||
([?\s-r] . exwm-reset)
|
||||
|
||||
;; Move between windows
|
||||
([s-left] . windmove-left)
|
||||
([s-right] . windmove-right)
|
||||
([s-up] . windmove-up)
|
||||
([s-down] . windmove-down)
|
||||
|
||||
;; Launch applications via shell command
|
||||
([?\s-o] . (lambda (command)
|
||||
(interactive (list (read-shell-command "$ ")))
|
||||
(start-process-shell-command command nil command)))
|
||||
|
||||
;; Switch workspace
|
||||
([?\s-w] . exwm-workspace-switch)
|
||||
|
||||
;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9)
|
||||
,@(mapcar (lambda (i)
|
||||
`(,(kbd (format "s-%d" i)) .
|
||||
(lambda ()
|
||||
(interactive)
|
||||
(exwm-workspace-switch-create ,i))))
|
||||
(number-sequence 0 9))))
|
||||
|
||||
(setq exwm-randr-workspace-monitor-plist '(2 "HDMI-0" 4 "HDMI-0"))
|
||||
(exwm-enable)
|
||||
|
||||
#+end_src
|
||||
|
@ -77,3 +77,7 @@
|
||||
:branch "main"))
|
||||
|
||||
(package! org-chef)
|
||||
|
||||
(package! simple-httpd)
|
||||
|
||||
(package! exwm)
|
||||
|
27
.doom.d/scripts/update-screens
Executable file
27
.doom.d/scripts/update-screens
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Get current IP address
|
||||
addr=$(ip -4 addr show $1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
|
||||
# The the relevant number (X) 192.168.X.YYY
|
||||
num=($(echo "$addr" | tr '.' '\n'))
|
||||
# Based on number set xrandr
|
||||
case ${num[2]} in
|
||||
2)
|
||||
# Primary monitor on left
|
||||
xrandr --output DP-4 --primary \
|
||||
--mode 2560x1440 --rate 144 \
|
||||
--pos 0x0 --rotate normal \
|
||||
--output HDMI-0 \
|
||||
--mode 2560x1440 --rate 144 \
|
||||
--pos 2560x0 --rotate normal
|
||||
;;
|
||||
1)
|
||||
# Primary monitor on right
|
||||
xrandr --output HDMI-0 \
|
||||
--mode 2560x1440 --rate 144 \
|
||||
--pos 0x0 --rotate normal \
|
||||
--output DP-4 --primary \
|
||||
--mode 2560x1440 --rate 144 \
|
||||
--pos 2560x0 --rotate normal
|
||||
;;
|
||||
esac
|
5
.xinitrc
5
.xinitrc
@ -1,2 +1,5 @@
|
||||
exec dbus-launch xmonad
|
||||
#exec dbus-launch xmonad
|
||||
#exec qtile start
|
||||
picom &
|
||||
exec dbus-launch --exit-with-session emacs -mm --debug-init
|
||||
#exec stumpwm start
|
||||
|
@ -12,6 +12,7 @@ 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
|
||||
@ -19,6 +20,8 @@ import XMonad.Layout.Tabbed
|
||||
import XMonad.Layout.WindowNavigation
|
||||
import XMonad.Layout.SimpleFloat
|
||||
import XMonad.Layout.HintedTile
|
||||
import XMonad.Layout.Grid
|
||||
|
||||
--Utilities
|
||||
import XMonad.Util.Run (spawnPipe)
|
||||
import XMonad.Util.SpawnOnce
|
||||
@ -42,9 +45,9 @@ myFocusFollowsMouse = True
|
||||
myModMask :: KeyMask
|
||||
myModMask = mod4Mask
|
||||
-- Define volume keys and commands
|
||||
lowerVolumeCmd = "pulseaudio-ctl down 2"
|
||||
raiseVolumeCmd = "pulseaudio-ctl up 2"
|
||||
muteVolumeCmd = "pulseaudio-ctl mute"
|
||||
lowerVolumeCmd = "pactl set-sink-volume @DEFAULT_SINK@ -2%"
|
||||
raiseVolumeCmd = "pactl set-sink-volume @DEFAULT_SINK@ +2%"
|
||||
muteVolumeCmd = "pactl set-sink-mute @DEFAULT_SINK@ toggle"
|
||||
-- Count windows
|
||||
windowCount :: X (Maybe String)
|
||||
windowCount = gets $ Just . show . length . W.integrate' . W.stack . W.workspace . W.current . windowset
|
||||
@ -87,7 +90,7 @@ projects =
|
||||
}
|
||||
]
|
||||
|
||||
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled Tall ||| tiled Wide ||| Full ||| simpleFloat)
|
||||
myLayout = windowNavigation $ spacing 2 $ smartBorders (tiled Tall ||| tiled Wide ||| Full ||| simpleFloat ||| Grid)
|
||||
where
|
||||
-- default tiling algorithm partitions the screen into two panes
|
||||
--tiled = Tall nmaster delta ratio
|
||||
@ -160,6 +163,7 @@ myManageHook = composeAll
|
||||
className =? "mpv" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
|
||||
className =? "Steam" --> doFullFloat,
|
||||
className =? "Superslicer" --> doFullFloat,
|
||||
isInProperty "WM_WINDOW_ROLE" "pop-up" --> doRectFloat (W.RationalRect 0.55 0.05 0.4 0.4),
|
||||
namedScratchpadManageHook myScratchPads]
|
||||
-- Set dynamic display modes
|
||||
myEventHook :: Event -> X All
|
||||
|
Loading…
x
Reference in New Issue
Block a user