xorg.lisp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. (in-package :stumpwm)
  2. (defcommand xkill () ()
  3. "Run `xkill'."
  4. (run-shell-command "xkill"))
  5. ;;;
  6. ;;; Configuration
  7. ;;;
  8. (defcommand cursor-theme () ()
  9. (run-shell-command "xsetroot -cursor_name left_ptr"))
  10. (defcommand xrdb () ()
  11. (run-shell-command (format nil "xrdb ~a/.Xresources" (getenv "HOME"))))
  12. ;;;
  13. ;;; Audio
  14. ;;;
  15. (defcommand speaker-disable () ()
  16. (run-shell-command "xset -b"))
  17. ;;;
  18. ;;; Keyboard
  19. ;;;
  20. ;; Use keyboard as mouse with <Shift+Num Lock>
  21. ;; https://en.wikipedia.org/wiki/Mouse_keys
  22. (defcommand pointer-keys () ()
  23. (run-shell-command "setxkbmap -option keypad:pointerkeys"))
  24. ;; Keyboard layout
  25. (defcommand keyboard-layout () ()
  26. (run-shell-command "setxkbmap -layout us,ru -option grp:win_space_toggle"))
  27. (defcommand xmodmap () ()
  28. (run-shell-command (format nil "xmodmap ~s" (concat (getenv "HOME") "/.Xmodmap"))))
  29. (defcommand keynav () ()
  30. (run-shell-command "keynav"))
  31. ;;;
  32. ;;; Screen
  33. ;;;
  34. (defcommand turn-screen-off () ()
  35. "Turn screen off."
  36. (run-shell-command "exec xset dpms force off"))
  37. (defcommand screen-off () ()
  38. (run-shell-command "xrandr --output HDMI3 --off"))
  39. (defcommand screen-on () ()
  40. (run-shell-command "xrandr --output HDMI3 --auto && xrandr --output HDMI3 --right-of HDMI1"))
  41. (defcommand reset-resolution-and-gamma () ()
  42. (run-shell-command "xrandr --output HDMI1 --mode 1920x1080 ; xgamma -gamma 1.0"))
  43. ;;;
  44. ;;; Drag and drop
  45. ;;;
  46. (defcommand drag-and-drop () ()
  47. (run-shell-command "dragon"))
  48. (defcommand drag-and-drop-and-exit () ()
  49. (run-shell-command "dragon --and-exit"))
  50. ;;;
  51. ;;; xdotool
  52. ;;;
  53. (defun xdotool-behave-screen-edge (command &key position (delay 500) (quiesce 500))
  54. (join (list "xdotool" "behave_screen_edge"
  55. "--quiesce" (write-to-string quiesce)
  56. "--delay" (write-to-string delay)
  57. position
  58. "exec" "--sync" command)))
  59. ;;;
  60. ;;; Hooks
  61. ;;;
  62. (add-hook *start-hook*
  63. (lambda ()
  64. (xrdb)
  65. (speaker-disable)
  66. (pointer-keys)
  67. (xmodmap)))