{"id":17171431,"url":"https://github.com/roosta/scripts","last_synced_at":"2025-04-13T16:10:38.804Z","repository":{"id":28710807,"uuid":"32231478","full_name":"roosta/scripts","owner":"roosta","description":"Collection of my personal shell scripts","archived":false,"fork":false,"pushed_at":"2025-04-11T14:07:16.000Z","size":352,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T14:54:31.043Z","etag":null,"topics":["bash","customization","script","utility"],"latest_commit_sha":null,"homepage":"https://roosta.sh","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roosta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-03-14T20:51:45.000Z","updated_at":"2025-04-11T13:55:31.000Z","dependencies_parsed_at":"2023-11-10T02:17:35.454Z","dependency_job_id":"ef488c14-5875-4b38-93ef-95a111012232","html_url":"https://github.com/roosta/scripts","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fscripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fscripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fscripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fscripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roosta","download_url":"https://codeload.github.com/roosta/scripts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741201,"owners_count":21154255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","customization","script","utility"],"created_at":"2024-10-14T23:34:30.082Z","updated_at":"2025-04-13T16:10:38.798Z","avatar_url":"https://github.com/roosta.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"Scripts\n=========\n\nThese are utility scripts I use on my systems that isn't a package, or is\nsimple enough to warrant a script file. These files are in flux, due to\nchanging requirements and environments.\n\nGoing forward most of these scripts target Wayland, Xorg scripts kept here for\nbackward compatibility so I can launch an i3 session for whatever reason. For a\nfull list of phased out scripts `checkout` the `deprecated` branch.\n\n- Companion repo for for my [dotfiles](https://github.com/roosta/etc)\n\n## Branches\n\n| Branch | Description |\n|--------|-------------|\n| [**main**](https://github.com/roosta/scripts) | Most current up to date scripts I use on the daily. |\n| [**deprecated**](https://github.com/roosta/scripts/tree/deprecated) | Deprecated scripts not in use |\n\n## Script descriptions\n\nShort descriptions for each script, not always up to date. Attribution where\npossible.\n\n### Power scripts\n\nScripts used in custom power menus, mostly using systemctl, but also uses\n[zenity](https://gitlab.gnome.org/GNOME/zenity) as a confirm dialog, cause I\nsometimes hit the wrong menu item.\n\n- [hibernate.sh](hibernate.sh)\n- [lock.sh](lock.sh)\n- [locker.sh](locker.sh)\n- [logout.sh](logout.sh)\n- [reboot.sh](reboot.sh)\n- [shutdown.sh](shutdown.sh)\n- [suspend.sh](suspend.sh)\n\n### Rofi Action Menu\n\nA Rofi menu with common actions I used to script or save as cmd one liners.\n\nWhen transitioning to Wayland, several desktop related tools stopped working,\nlike `flameshot`, or `gpick`. So I needed some alternatives for Wayland. I set it\nup as a Rofi menu with generic scripts, so that it can be swapped out on\nneed.\n\n- [colorpicker.sh](colorpicker.sh)\n  - [hyprpicker](https://github.com/hyprwm/hyprpicker)\n  - [wl-clipboard](https://github.com/bugaevc/wl-clipboard)\n- [monitor.sh](monitor.sh)\n  - [alacritty](https://github.com/alacritty/alacritty)\n  - [btop](https://github.com/aristocratos/btop)\n- [screenshot.sh](screenshot.sh)\n  - [grim](https://git.sr.ht/~emersion/grim)\n  - [slurp](https://github.com/emersion/slurp)\n  - [swappy](https://github.com/jtheoof/swappy)\n\nUsing with you could put something like this in your WM/compositor config:\n```i3\nbindsym $mod+grave exec rofi -show menu -modes \"menu:~/scripts/rofi-menu.sh\" -show-icons\n```\n\n### [add-vim-plugin.sh](add-vim-plugin.sh)\n\nWill create a lua file from a github repo identifier: `username/repo`. This was created to\nspeed up migration from `vimrc` to `init.lua`\n\nRequirements:\n\n- [Toilet](https://github.com/cacalabs/toilet)\n- [figlet-fonts](https://github.com/xero/figlet-fonts)\n\nAlso asumes [lazy.nvim](https://lazy.folke.io/) is being used with a\n[structured file layout](https://lazy.folke.io/usage/structuring).\n\nUsage:\n\n```sh\n./add-vim-plugin.sh \"roosta/fzf-folds.vim\"\n```\n\nResulting file:\n\n```./fzf-folds.lua\n-- ┬─┐┌─┐┬─┐  ┬─┐┌─┐┬  ┬─┐┐─┐ ┐ ┬o┌┌┐\n-- ├─ ┌─┘├─ ──├─ │ ││  │ │└─┐ │┌┘││││\n-- ┆  └─┘┆    ┆  ┘─┘┆─┘┆─┘──┘o└┘ ┆┘ ┆\n-- ─────────────────────────────────────────────────────────────────────────\n\nreturn {\n  \"roosta/fzf-folds.vim\",\n}\n```\n### [bookmarks_md.mjs](bookmarks_md.mjs)\n\nNode script to grab bookmarks from chrome/firefox in a folder on the toolbar\ncalled `capture`. Converts the bookmarks to markdown links.\n\n### [crypthelper.sh](crypthelper.sh)\n\nScript to simplify opening and mounting dm-crypt encrypted partitions. Really\nnot terribly useful I just kept forgetting how to do it, so I wrote this.\n\nIt is used like so:\n\n```bash\n./crypthelper.sh open /dev/sdh1 my-encrypted-device-name # gets mounted in ~/mnt/[name]\n./crypthelper.sh close my-encrypted-device-name\n```\n\n### [figlet-list.sh](figlet-list.sh)\n\nScript to display all toilet/figlet fonts with sample text. It will try\n`/usr/share/figlet` and `/usr/share/figlet/fonts`. I got extra fonts installed\nin the latter.\n\nRequirements:\n\n- https://github.com/cacalabs/toilet\n\u003e Could be modified to use figlet\n\nOptionally:\n- https://github.com/xero/figlet-fonts\n\nRefs:\n\n- https://github.com/xero/figlet-fonts\n- https://github.com/xero/dotfiles\n\n### [flush.sh](flush.sh)\n\nWIP script to flush credentials and secrets.\n\n### [git-ls-large-files.sh](git-ls-large-files.sh)\n\nSee which files in a git repo history takes up the most space. Useful if\npruning assets or similar from a repo.\n\nSource: https://stackoverflow.com/questions/13403069/how-to-find-out-which-files-take-up-the-most-space-in-git-repo\n\n### [iommu-groups.sh](iommu-groups.sh)\n\nList all IOMMU groups for system. Used this when setting up PCI passthrough to\na virtual machine. More info [here](https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF).\n\n### [keyboard-layout.sh](keyboard-layout.sh)\n\n\u003e DEPECATED: Xorg is getting phased out for wayland, kept for backward\n\u003e compatibility temporarily\n\nEcho keyboard layout code/caps lock and formatting for [polybar](https://github.com/jaagr/polybar)\n\nI like my indicator to have a red background on Norwegian layout and caps-lock\nsince it always trips me up when this is activated. Only works for Norwegian\nand US layouts. Could easily be modified though.\n\nHow to use: In polybar setup a module using IPC:\n\n```conf\n[module/keyboard-layout]\ntype = custom/ipc\nformat-foreground = ${colors.brightwhite}\nformat = \u003coutput\u003e\nhook-0 = ~/scripts/keyboard-layout.sh\ninitial = 1\n```\n\nThen in i3 setup something like this:\n\n```conf\nbindsym --release Caps_Lock exec polybar-msg hook keyboard-layout 1\n```\n\nThis triggers an ipc message when releasing caps lock, which I have setup via xorg to toggle between layouts.\n\nRemember to enable ipc for your bar:\n\n```conf\n[bar/primary]\nenable-ipc = true\n```\n\nOriginal source: \u003chttp://unix.stackexchange.com/a/27688\u003e\n\n### [launch-polybar.sh](launch-polybar.sh)\n\n\u003e DEPECATED: Xorg is getting phased out for wayland, kept for backward\n\u003e compatibility temporarily\n\nCalled on i3 startup to launch whatever polybar layout `hostname` requires.\n\n```\nexec_always --no-startup-id $HOME/scripts/launch-polybar.sh\n```\n\nI have multiple monitors, so I launch several bars depending on hostname, since\nthe number of screens vary, so does the configs.\n\n\n### [rainbow.sh](rainbow.sh)\n\nScript used to troubleshoot true color in terminal, will print a rainbow and\nhow it looks depends on what colors are supported by your terminal.\n\nMore on that [here](https://gist.github.com/XVilka/8346728).\n\n### [tmux-attach.sh](tmux-attach.sh)\n\nAttach to an existing session, or create a new. Useful if you want tmux to\nalways be started with terminal emulator. Source either in shell rc file, or in\nwindow manager on terminal emulator startup. Believe I got from\n[here](https://wiki.archlinux.org/index.php/Tmux#Start_tmux_with_default_session_layout).\n\n### [tmux-main.sh](tmux-main.sh)\n\nI run this manually to start a default tmux session layout. Check for existing\nnamed session, attach, or create a new named session called main. Opted for this\nsolution rather than using a session manager, even though there are\n[several](https://wiki.archlinux.org/index.php/Tmux#Start_tmux_with_default_session_layout)\n[nice](https://github.com/junegunn/heytmux)\n[ones](https://github.com/tmuxinator/tmuxinator).\n\n\n### [tmux-notify.sh](tmux-notify.sh)\n\nUse libnotify to notify when a tmux window receives a bell. Used with\n`tmux-update-window.sh`.\n\nExample:\n```tmux\nset-hook -g alert-silence 'run \". ~/utils/tmux-notify.sh; return 0\"'\n```\n\n### [tmux-ssh.sh](tmux-ssh.sh)\n\nStarts a new session called `ssh` that launches [ngrok](https://ngrok.com/), I\nuse this sometimes if I need to access a computer over ssh that doesn't have a\nstatic ip.\n\nTakes TCP PORT as argument to ngrok.\n\n### [tmux-update-window.sh](tmux-update-window.sh)\n\nCreate an update window if `main` session exist. Set this window to monitor\nsilence. When I start an update, and then do something else I'd like to be\nalerted on silence since that indicates that its either finished or requires\ninput.\n\n### [toggle-sinks.sh](toggle-sinks.sh)\n\nRequirements:\n\n- `pulseaudio` / `pipewire-pulse`\n\nToggles between two sinks using pactl, takes two arguments, which are the\nsinks you wish to toggle between. Using on pipewire, pipewire-pulse. To list\nsinks use `pactl list sinks short`.\n\n#### Usage:\n\n```sh\n./toggle-sinks.sh [SINK1] [SINK2]\n```\n\nI have two outputs I toggle between often: headset and speakers. I've added\nthis script to [Waybar](https://github.com/Alexays/Waybar), and activate it by\nclicking on the volume module.\n\n```jsonc\n\"pulseaudio\": {\n    // ...\n    \"on-click\": \"~/scripts/toggle-sinks.sh 'alsa_output.usb-SteelSeries_SteelSeries_Arctis_7-00.stereo-game' 'alsa_output.pci-0000_00_1b.0.analog-stereo'\",\n    \"on-click-middle\": \"pavucontrol\"\n    // ...\n\n},\n```\n### [torrent-done.sh](torrent-done.sh)\n\nExtract `rar` archives on torrent completion, used in [transmission](https://github.com/transmission/transmission)\n\n### [touchpad-toggle.sh](touchpad-toggle.sh)\n\n- TODO: Fix for wayland\n\nToggles touchpad on or off.\n\nUsed in i3wm config like so:\n\n```i3\nbindsym XF86TouchpadToggle exec --no-startup-id ~/utils/touchpad-toggle.sh\n```\n### [updates-arch-combined.sh](updates-arch-combined.sh)\n\n\u003e DEPECATED: Xorg is getting phased out for wayland, kept for backward\n\u003e compatibility temporarily.\n\nWill output formatted text for Polybar, checking Arch Linux `pacman` updates, as\nwell as AUR updates.\n\n### [waybar-dev.sh](waybar-dev.sh)\n\nRequirements:\n- [entr](https://eradman.com/entrproject/)\n- [Waybar](https://github.com/Alexays/Waybar)\n\nUses `entr` to watch for changes in my Waybar config files, and will restart\nWaybar on save. I use this when I develop themes and customization, you can\npass `-d` to open a GTK debugger window as well, to get CSS selectors used for\nstyling Waybar.\n\n### [wl-prop.sh](wl-prop.sh)\n\n- source: https://gist.github.com/crispyricepc/f313386043395ff06570e02af2d9a8e0#file-wlprop-sh\n\nRequirements:\n\n- `swaymsg`\n- `jq`\n- `slurp`\n- `awk`\n\nWorks similarly to `xprop` in xorg. Running this will start a window selection,\nand output the relevant node from the Sway tree.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosta%2Fscripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froosta%2Fscripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosta%2Fscripts/lists"}