Skip to content

Instantly share code, notes, and snippets.

@luerhard
Last active October 11, 2018 23:24
Show Gist options
  • Save luerhard/ef77930809d4426566da95447203fdb0 to your computer and use it in GitHub Desktop.
Save luerhard/ef77930809d4426566da95447203fdb0 to your computer and use it in GitHub Desktop.
Funny things and tricks I found out about Linux Mint configuration options and bugfixes

Fix Two-Finger-Scroll Bug on Lenovo Thinkpad (multiple versions)

A lot of people have problems with the Touchpad on Thinkpads after suspends in multiple kernel versions. A lot of times, the scrolling does not work anymore after wakeup. Here is a way to fix it.

  • go to /etc/default/grub
  • find the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
  • change the line to GRUB_CMDLINE_LINUX_DEFAULT="quiet splash psmouse.synaptics_intertouch=0"
  • execute command in terminal "sudo update-grub"
  • restart

Width of Jupyter Noteboooks

  • create config with the command "jupyter notebook --generate-config"
  • in the newly created ~/.jupyter folder create a folder named "custom"
  • in the new ~/.jupyter/custom folder create a file named custom.css
  • write ".container { width:100% !important; }" in the custom.css file
  • save and close the file, restart the jupyter notebook server if it is running

Correct Batterystatus with batterymonitor@pdcurtis

The Cinnamon-Applet batterymonitor@pdcurtis is nice, but it can't handle multiple batteries. With this Script and some configuration one can fix it.

  • Install the Applet
  • Switch to the Applet-Folder, usually ~/.local/share/cinnamon/applets/batterymonitor@pdcurtis
  • make a backup and replace the contents of the file batteryscript.sh with the following lines:
#!/bin/sh
#Script calls python file to update battery state and battery percentage 
python ~/.local/share/cinnamon/applets/batterymonitor@pdcurtis/replace_battery_values.py
exit 0
  • Create a new file named replace_battery_values.py and put the following content in it:
#!python

from subprocess import check_output
import re

#read command-prompt
raw_out = check_output(["inxi", "-Bxxc0"]).decode("utf-8")

# Calculate Percentage
batteries = re.findall(r"charge: ([0-9\.]{1,4}) Wh (?:.*?) condition: ([0-9\.]{1,4})/", raw_out)

currents, capables =zip(*batteries)
current = sum(float(c) for c in currents)
capable = sum(float(c) for c in capables)
percentage = int(current / capable * 100)

with open("/tmp/.batteryPercentage", "w") as file:
    file.write(str(percentage)+"\n")

#Get status
statuses = re.findall(r"status: (.*?)\n", raw_out)
status = ", ".join([s for s in statuses if s != "N/A"])


with open("/tmp/.batteryState", "w") as file:
    file.write(status + "\n")

Installing graph-tool in anaconda environments

Follow the steps, maybe adjust the python-folders as well as the environment-name in the paths. This is for Ubuntu with bionic version (Otherwise the Ubuntu distribution as to be adapted in the deb / deb-src lines).

sudo apt-key adv --keyserver pgp.skewed.de --recv-key 612DEFB798507F25
sudo add-apt-repository -s "deb http://downloads.skewed.de/apt/bionic bionic universe"
sudo apt update
sudo apt install python3-graph-tool, python-gi-dev
conda install scipy, pycairo, matplotlib

ln -s /usr/bin/python3/dist-packages/graph_tool ~/anaconda3/envs/networks/lib/python3.7/site-packages/
ln -s /usr/bin/python3/dist-packages/gi ~/anaconda3/envs/networks/lib/python3.7/site-packages/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment