A variety of simple automation scripts and enhancements to Sway and i3.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 6.6KB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. # Simple Scripts
  2. ## Audio
  3. **audio/mute.sh**
  4. Just a simple script to toggle Alsa mute.
  5. **audio/noise-cancel.sh**
  6. Add a noise-cancelled version of existing interfaces to Pulseaudio.
  7. **audio/stream-podcasts.pl**
  8. Commandline podcast streamer. Fetchs the feed for desired podcasts, find items
  9. published today, then plays them in order. Given arguments, it will use those
  10. as feeds, otherwise it will use the hash listed in the script.
  11. ## i3
  12. I haven't used i3 in earnest for quite some time since moving to Sway, so it is
  13. very likely that some of these scripts are broken based on other config changes.
  14. **i3/i3move.sh**
  15. When any of the Xrandr scripts below is run, it will print it's name to a config
  16. file. This script will read that config file and then knows how the outputs are
  17. arranged. Once this is known, it allows hotkeys to know which output to move a
  18. workspace to.
  19. **i3/detached.sh**
  20. Xrandr config. Just the laptop display.
  21. **i3/detached.sh**
  22. Xrandr config. Just the laptop display.
  23. **i3/home.sh**
  24. Xrandr config. Not a layout I currently use. Home is now the "stacked" view from
  25. sway/displays.
  26. **i3/work.sh**
  27. Xrandr config. Vertical on the left, horizontal aligned to top of the vertical,
  28. and laptop directly below that. Left-to-right order is
  29. Vertical-Horizontal-Laptop.
  30. ## Rofi
  31. [Rofi](https://github.com/davatorium/rofi) is a neat graphical launcher and menu
  32. system. I use it for a bunch of stuff to supplement i3 and Sway to fill out same
  33. desktop niceties. See configs in 'dotfiles' repository.
  34. **rofi/drun.sh**
  35. Simple launcher.
  36. **rofi/rofi-openvpn.sh**
  37. Quick VPN switcher.
  38. **rofi/rofi-power-menu.sh**
  39. Lock, log out, restart Sway/i3, restart waybar, hibernate, reboot, shutdown.
  40. **rofi/rofi-send-to-kodi.sh**
  41. Forward pasted link to ./send-to-kodi.sh.
  42. **rofi/rofi-ssh-menu.sh**
  43. Open a terminal to any SSH shortcut machine. (TODO: Integrate with 'sshs' to get
  44. machine list from there instead of a static list).
  45. **rofi/sway-alt-tab.sh**
  46. Show all currently running applications in Sway to locate window.
  47. ## Sway
  48. [Sway](https://github.com/swaywm/sway) is an i3-compatible Wayland compositor
  49. and tiling window manager. See configs in 'dotfiles' repository. Here are some
  50. scripts exclusively for automating or enhancing Sway.
  51. **sway/displays.pl**
  52. Script to automatically configure wayland outputs using swaymsg. Also forks
  53. waybars for each display. Allows custom configurations. No argument will run the
  54. last used configuration (~/config/last_display). '-w' will run only waybar
  55. without changing displays.
  56. **sway/gammastep.pl**
  57. Setup Gammastep based on current location. I don't have geolocation in my
  58. laptop, so this requires a URL that returns JSON, including a "lat" and "lon".
  59. My URL (restricted to my IPs) returns these as recorded by PhoneTrack on my
  60. phone similar to:
  61. ```
  62. {"lat":"180.12345678","lon":"-180.12345678","timestamp":"1599831660"}
  63. ```
  64. It forks to keep running if terminal is killed. If location fails to be fetched
  65. it will try again every 5 seconds.
  66. **sway/popup-term.pl**
  67. A DIY version of the Tilde terminal. If terminal is not running, it opens on the
  68. current display. If it is running but not on current dislpay, it moves to
  69. current display. If it is already on current display, it is moved to a hidden
  70. display ('grave').
  71. Note the relevant settings in dotfiles repository (sway/config) related to the
  72. 'grave' workspace, as well as UXTerm.
  73. ```
  74. for_window [class="UXTerm"] floating enable, resize set height 600px, resize set width 800px, move position 1120px 460px
  75. # Grave '`' key, DIY version of Tilde pop-up terminal
  76. bindsym $mod+Grave exec /home/jpm/scripts/sway/popup-term.pl
  77. # Visit the hidden grave workspace
  78. bindsym $mod+Shift+Grave workspace grave
  79. ```
  80. Also note that 'grave' has no label in waybar (waybar/config.template) to allow
  81. it to be *hidden*.
  82. ```
  83. "sway/workspaces": {
  84. "format": "{icon}",
  85. "format-icons": {
  86. "0": "0 \uf073", // Example of workspace with a label
  87. "grave": "",
  88. ...
  89. ```
  90. **sway/swayidle.sh**
  91. Work in progress. These scripts don't currently work the way I like.
  92. Sway has an Idle detection daemon that can flexibly take different actions after
  93. certain periods of inactivity as well as prior to sleep and after wake.
  94. This script is meant to unify all of the actions into one script by accepting an
  95. option.
  96. **sway/swayidlecountdown.sh**
  97. Prior to locking a countdown should be provided. Currently testing how to manage
  98. a countdown with Dunst, which doesn't actually support dynamic notifications.
  99. ## Thinkpad
  100. **thinkpad/blc.pl**
  101. Overly complicated backlight brightness control script. Provides flexible
  102. control of backlight so that changes can be easily scripted or called from
  103. keyboard shortcuts. --help provides some usage docs.
  104. **thinkpad/kbd_backlight.pl**
  105. Simple script to cycle keyboard backlight. Gets max brightness, current
  106. brightness and then changes then increments the current brightness. Uses mod of
  107. max+1 so that it will cycle back around to 0 (disabled) if it is already at max.
  108. **thinkpad/user-thinkpad-control@.service**
  109. SystemD unit file used to give ownership of necessary sys files to whichever
  110. user it is enabled for `systemctl enable user-thinkpad-control@jpm`. Without
  111. this, the user won't be able to write these files and thus cannot set brightness
  112. values.
  113. ## Waybar
  114. [Waybar](https://github.com/Alexays/Waybar) is a very flexible and customizable
  115. taskbar for Sway (and other Wlroots-based wayland compositors). Waybar applets
  116. have hover and click functionality and have several scripts related to those.
  117. See the .config repository for the actual Waybar and Sway configs.
  118. **waybar/waybar-cpu.sh**
  119. Launch htop in floating window (bottom-right). If already running, kill it.
  120. **waybar/waybar-disk.sh**
  121. Notification with disk usage summaries. Renders properly with Dunst, but not
  122. Mako.
  123. **waybar/waybar-mem.sh**
  124. Notification with memory usage summaries.
  125. **waybar/waybar-nmtui.sh**
  126. Launch nmtui in floating window (bottom-right). If already running, kill it.
  127. ## Miscellaneous
  128. **apply-gruvbox.sh**
  129. A single theme version of the one provided
  130. [here](https://raw.githubusercontent.com/Mayccoll/Gogh). Applies the theme to a
  131. variety of terminals. Not really necessary after cloning the 'dotfiles'
  132. repository.
  133. **send-to-kodi.sh**
  134. [This script](https://github.com/allejok96/send-to-kodi) sends a URL or local
  135. file to a [Kodi](https://github.com/xbmc) media player. Only modified to have my
  136. local media server IP.
  137. **setup_wireguard.sh**
  138. Script to install WireGuard and generate a config file. Requires modification
  139. with the server public IP, server public key, and change to first 3 octets if
  140. necessary. Will attempt to resolve dependencies and has a special case for
  141. Raspberry Pi (detected with `uname -m` as 'arm'.