Skip to content

Instantly share code, notes, and snippets.

View set-default-sink.sh
#!/usr/bin/env bash
# Set default pulseaudio sink and move all sink inputs there
# Requires
# load-module module-stream-restore restore_device=false
# in /etc/pulse/default.pa
[ -z "$1" ] && echo "You must specify a sink (either index or name):
$(pacmd list-sinks | grep index -A 1)" && exit 1
View toggle-default-sink.sh
#!/usr/bin/env bash
# Toggle between two pulseaudio sinks
# Requires
# load-module module-stream-restore restore_device=false
# to be set in /etc/pulse/default.pa
# Current default sink
CURR_SINK_INDEX="$(pacmd list-sinks | grep \* | awk '{print $3}')"
@Sporif
Sporif / nvidia.sgrd
Last active Mar 12, 2019
ksysguard sensor file for Nvidia. Requires https://gist.github.com/Sporif/4ce63f7b6eea691bdbb18905a9589169 to be in path
View nvidia.sgrd
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KSysGuardWorkSheet>
<WorkSheet title="Nvidia" columns="2" rows="4" locked="0" interval="1">
<host name="127.0.0.1" port="-1" shell="" command="nvidia-gpu-sensor.pl"/>
<display labels="1" svgBackground="" vScroll="1" version="1" class="FancyPlotter" vLines="1" unit="" row="0" hScale="3" autoRange="1" fontSize="8" manualRange="0" rowSpan="1" columnSpan="1" showUnit="0" vDistance="30" column="0" stacked="0" title="GPU Temp" hLines="1">
<beam sensorName="gpu_temp" sensorType="integer" color="0xff0057ae" hostName="127.0.0.1"/>
</display>
<display labels="1" svgBackground="" vScroll="1" version="1" class="FancyPlotter" vLines="1" unit="" row="0" hScale="3" autoRange="1" fontSize="8" manualRange="0" rowSpan="1" columnSpan="1" showUnit="0" vDistance="30" column="1" stacked="0" title="GPU Fan Speed" hLines="1">
<beam sensorName="gpu_fan_speed" sensorType="integer" color="0xff0057ae" hostName="127.0.0.1"/>
</display>
@Sporif
Sporif / nvidia-gpu-sensor.pl
Last active Apr 4, 2019 — forked from hacker1024/nvidia-gpu-sensor.pl
KDE KSysGuard NVIDIA GPU temperature/memory/utilization sensor, based on @frantic1048's script, but with units and total memory detection.
View nvidia-gpu-sensor.pl
#!/usr/bin/perl -w
# act as a KSysGuard sensor
# provides NVIDIA GPU info via `nvidia-smi`
# Usage:
# 1. Save this script, make it executable and move it to a directory in your $PATH
# 2. Save this ksysguard sensor file for Nvidia: https://gist.github.com/Sporif/31f0d8d9efc3315752aa4031f7080d79
# 2. In KSysGuard's menu, open "File > Import Tab From File option"
# 3. Open the sensor file (nvidia.srgd)
@Sporif
Sporif / protonenv
Last active Apr 10, 2019
A simple script that sets environment variables to allow launching applications using Proton's wine
View protonenv
#!/usr/bin/env bash
# A simple script that sets environment variables to allow launching applications using Proton's wine
# You can either source the script for use in the current shell, after which you can use wine commands as usual
# Or execute it with a program as the arguments e.g `protonenv winetricks` or `protonenv winecfg`
# Paths to check for Steam installation
STEAM_DIRS="
$HOME/.local/share/Steam
$HOME/.steam/steam
@Sporif
Sporif / suspend-kwin.sh
Last active Apr 4, 2019
Suspend KWin X11 compositing when certain windows are in focus and fullscreen. Looks in ~/.config/suspend-kwin/app_list for programs to suspend.
View suspend-kwin.sh
#!/usr/bin/env bash
# Suspend KWin X11 compositing when certain windows are in focus and fullscreen
# Requirements:
# qdbus: suspend compositing, check status of compositing
# xprop: find window in focus and if fullscreen
# The "Suspend Compositing" global shortcut to be present and enabled
# Credits to: https://askubuntu.com/a/1017567, https://bbs.archlinux.org/viewtopic.php?pid=994356#p994356
@Sporif
Sporif / downloads-sidebar.uc.xul
Created Dec 23, 2017
Adds a downloads sidebar, with CTRL+J to open it and CTRL+SHIFT+J to open the downloads window. Requires https://gist.github.com/Sporif/db6b3440fba0b1bcf5477afacf93f875
View downloads-sidebar.uc.xul
<?xml version="1.0"?>
<overlay id="downloads-sidebar" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript"><![CDATA[
document.addEventListener("keypress", event => {
if((event.which === 106 || event.which === 74) && event.ctrlKey) {
event.preventDefault();
if(event.shiftKey)
BrowserDownloadsUI();
else
SidebarUI.toggle('viewDownloadsSidebar');
@Sporif
Sporif / dark-scrollbar.as.css
Last active Apr 13, 2019
Dark scrollbar for Firefox 57. Tested on Windows 10. Requires https://gist.github.com/Sporif/db6b3440fba0b1bcf5477afacf93f875
View dark-scrollbar.as.css
scrollbar, scrollbar *, scrollcorner {
-moz-appearance: none !important;
--scrollbar-width: 10px;
--scrollbar-height: var(--scrollbar-width);
}
scrollbar, scrollcorner {
background: #282828 !important;
}
scrollbar[orient="vertical"] {
@Sporif
Sporif / RestartFirefoxButton_Movable.uc.js
Last active Apr 11, 2019
Restart Button for Firefox. An updated version of https://github.com/Endor8/userChrome.js/tree/master/restartfirefoxbutton_movable. Middle click also empties the script cache.
View RestartFirefoxButton_Movable.uc.js
(function() {
if(location != 'chrome://browser/content/browser.xul')
return;
try {
CustomizableUI.createWidget({
id: 'restart-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
@Sporif
Sporif / userChrome.css
Last active Apr 11, 2019
Add userChrome.js support to Firefox with just userChrome.css. A compact version of https://github.com/Sporif/firefox-quantum-userchromejs. Instead of loading userChrome.xml file it uses a data URI.
View userChrome.css
#PanelUI-menu-button {
-moz-binding: url(data:text/xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIj8+CjwhLS0gQ29weXJpZ2h0IChjKSAyMDE3IEhhZ2dhaSBOdWNoaQpBdmFpbGFibGUgZm9yIHVzZSB1bmRlciB0aGUgTUlUIExpY2Vuc2U6Cmh0dHBzOi8vb3BlbnNvdXJjZS5vcmcvbGljZW5zZXMvTUlUCiAtLT4KCjwhLS0gUnVuIHVzZXJDaHJvbWUuanMvdXNlckNocm9tZS54dWwgYW5kIC51Yy5qcy8udWMueHVsLy5jc3MgZmlsZXMgIC0tPgo8YmluZGluZ3MgeG1sbnM9Imh0dHA6Ly93d3cubW96aWxsYS5vcmcveGJsIj4KICAgIDxiaW5kaW5nIGlkPSJqcyIgZXh0ZW5kcz0iY2hyb21lOi8vZ2xvYmFsL2NvbnRlbnQvYmluZGluZ3MvdG9vbGJhcmJ1dHRvbi54bWwjbWVudSI+CiAgICAgICAgPGltcGxlbWVudGF0aW9uPgogICAgICAgICAgICA8Y29uc3RydWN0b3I+PCFbQ0RBVEFbCiAgICAgICAgICAgICAgICBpZih3aW5kb3cudXNlckNocm9tZUpzTW9kKSByZXR1cm47CiAgICAgICAgICAgICAgICB3aW5kb3cudXNlckNocm9tZUpzTW9kID0gdHJ1ZTsKICAgICAgICAgICAgICAgIHZhciBjaHJvbWVGaWxlcyA9IEZpbGVVdGlscy5nZXREaXIoIlVDaHJtIiwgW10pLmRpcmVjdG9yeUVudHJpZXM7CiAgICAgICAgICAgICAgICB2YXIgeHVsRmlsZXMgPSBbXTsKICAgICAgICAgICAgICAgIHZhciBzc3MgPSBDY1snQG1vemlsbGEub3JnL2NvbnRlbnQvc3R5bGUtc2hlZXQtc2VydmljZTsxJ10uZ2V0U2VydmljZShDaS5uc0lTdH
You can’t perform that action at this time.