#!/usr/bin/python # Launcher Toggle v.1 # (c) Amos Brocco from gi.repository import Gtk, GLib, Gio from gi.repository import AppIndicator3 as appindicator import os icons = ("face-smile", "face-wink") def cb_exit(w, data): Gtk.main_quit() def get_state(): return gsettings.get_int('launcher-hide-mode') def update_icon(state): ind_app.set_icon(icons[get_state()]) def cb_togglelauncher(w, data): state = (get_state() + 1) % 2 gsettings.set_int('launcher-hide-mode', state) update_icon(state) return 1 gsettings = Gio.Settings.new_with_path('org.compiz.unityshell', '/org/compiz/profiles/unity/plugins/unityshell/') ind_app = appindicator.Indicator.new_with_path ( \ "showlauncher-indicator",\ icons[get_state()],\ appindicator.IndicatorCategory.APPLICATION_STATUS,\ os.path.dirname(os.path.realpath(__file__))) ind_app.set_status (appindicator.IndicatorStatus.ACTIVE) menu = Gtk.Menu() toggle_item = Gtk.MenuItem("Toggle") menu.append(toggle_item) toggle_item.connect("activate", cb_togglelauncher, '') toggle_item.show() exit_item = Gtk.MenuItem("Exit") menu.append(exit_item) exit_item.connect("activate", cb_exit, '') exit_item.show() ind_app.set_menu(menu) Gtk.main()
Save this in a file (ex. key-rotate-display.sh) give it execute permissions and add to startup applications
#!/bin/bash HP_WMI_NAME="HP WMI hotkeys" KEY_ID="161" primaryScreen=`xrandr | grep primary | cut -d' ' -f1` touchDev=`xinput --list | grep "Wacom .* touch" | grep -o "id=[0-9]*\W" | grep -o "[0-9]*"` eraserDev=`xinput --list | grep "Wacom .* eraser" | grep -o "id=[0-9]*\W" | grep -o "[0-9]*"` stylusDev=`xinput --list | grep "Wacom .* stylus" | grep -o "id=[0-9]*\W" | grep -o "[0-9]*"` function rotate_display() { ROTATE="NONE" DISP="normal" VGADISP="normal" if [ "$1" == "half" ]; then ROTATE="HALF" DISP="inverted" VGADISP="normal" elif [ "$1" == "left" ]; then ROTATE="CCW" DISP="left" elif [ "$1" == "right" ]; then ROTATE="CW" DISP="right" fi xsetwacom set "$touchDev" Rotate $ROTATE xsetwacom set "$eraserDev" Rotate $ROTATE xsetwacom set "$stylusDev" Rotate $ROTATE xrandr -o $DISP } trap "kill 0" SIGINT exec 3< <(stdbuf -o0 xinput test "$HP_WMI_NAME") while read <&3 data; do if echo $data | grep "$KEY_ID" | grep "release" >/dev/null; then currentRotation=$(xrandr -q -v | grep "$primaryScreen" | cut -d ' ' -f 5 | grep -v '(') nextRotation="" if [ -z "$currentRotation" ]; then nextRotation="right" elif [ "$currentRotation" == "right" ]; then nextRotation="half" elif [ "$currentRotation" == "inverted" ]; then nextRotation="left" else nextRotation="none" fi rotate_display $nextRotation fi done
Because gnome tool does not work
#!/bin/bash X_IFS=${IFS} IFS='%' DEVICES=( `xsetwacom --list devices | tr "\t" "%" | cut -d% -f1 | tr "\n" ","` ) IFS=',' DEVICES=( $DEVICES ) value=$(zenity --list --title "Window title" --text "Select the input device you want to calibrate" --column "Detected input devices" "${DEVICES[@]}" ) value=$(echo $value | sed 's/ *$//g') IFS=${X_IFS} xinput_calibrator --device "$value" > /tmp/__xinput_cal.data MinX=$(cat /tmp/__xinput_cal.data | grep Option | grep MinX | awk '{print $3}' | tr \" " ") MaxX=$(cat /tmp/__xinput_cal.data | grep Option | grep MaxX | awk '{print $3}' | tr \" " ") MinY=$(cat /tmp/__xinput_cal.data | grep Option | grep MinY | awk '{print $3}' | tr \" " ") MaxY=$(cat /tmp/__xinput_cal.data | grep Option | grep MaxY | awk '{print $3}' | tr \" " ") rm /tmp/__xinput_cal.data xsetwacom --set "$value" area $MinX $MinY $MaxX $MaxY
#!/bin/bash cd /usr/lib rm libGL.so.1 ln -s libGL.so.1.2 libGL.so.1
Create a open.sh file somewhere with:
#!/bin/sh if [ $# = 0 ]; then nautilus "$PWD" elif [ -d "$1" ]; then nautilus "$1" else xdg-open "$1" fi
make it executable, then run
exo-preferred-applications
and set your script as the default file manager. Now for files the default viewer will be opened (for example, evince for pdf) and nautilus for folders.
If the USB controller shares interrupts with the NVIDIA card, Powermizer could cause crackling sound when an USB sound card or headphone is connected.
To solve, I forced the Powermizer settings at the lowest performance by adding
Option "Coolbits" "1" Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
To the “Device” section in xorg.conf Other info at http://linux.aldeby.org/nvidia-powermizer-powersaving.html
Simple FUSE module that manages the files that have been copied / pasted
#!/usr/bin/env python # ClipFuser # FUSE filesystem to display files in the clipboard # Copyright (C) 2011 Amos Brocco # License: LGPL3 # version 0.01 - February 1. 2011 # FIXME: Crashes with non-local uris import os, sys import gio import urllib import fuse from fuse import Fuse import gtk import time from threading import Thread,Lock fuse.fuse_python_api = (0, 2) fuse.feature_assert('has_init') class ClipWatcher(Thread): def __init__(self, fuser): Thread.__init__(self) self.__fuser = fuser self.clipboard = gtk.Clipboard() self.shouldRun = True def run(self): print "Starting watcher" while self.shouldRun: time.sleep(1) ret = self.clipboard.wait_for_contents("text/uri-list") if ret != None: self.clipboard.request_contents("text/uri-list", self.updateFromClipboard) def updateFromClipboard(self, clipboard, selection_data, data=None): contents = selection_data.data if contents is not None: contents = contents.split("\r\n") ccontents = {} for e in contents: if e.strip() != "": f = gio.File(uri=e) rpath = f.get_path() rpath.replace(" ","%20") ccontents['/'+f.get_basename()] = rpath self.__fuser.update(ccontents) def cleanup(self): self.shouldRun = False class ClipFuser(Fuse): def __init__(self, *args, **kw): Fuse.__init__(self, *args, **kw) self.ccontents = {} self.watcher = ClipWatcher(self) self.watcher.start() self.mutex = Lock() def update(self, c): self.mutex.acquire() self.ccontents = c self.mutex.release() def cleanup(self): self.watcher.cleanup() def getattr(self, path): self.mutex.acquire() data = self.ccontents self.mutex.release() if data.has_key('/'+path): path = data['/'+path] return os.lstat(path) elif path == '/': return os.lstat("./") else: return os.lstat(path) def readdir(self, path, offset): self.mutex.acquire() data = self.ccontents self.mutex.release() if (path == '/'): for e in data.keys(): yield fuse.Direntry(data[e]) else: for e in os.listdir("."+path): yield fuse.Direntry(e) def main(): server = ClipFuser() server.parse(values=server, errex=1) server.main() server.cleanup() if __name__ == '__main__': main()