<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: WallClocks</title>
    <description>The latest articles on DEV Community by WallClocks (@wallclocks).</description>
    <link>https://dev.to/wallclocks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F115671%2F3beaf6d4-1357-490c-84c4-1cc023af7529.jpg</url>
      <title>DEV Community: WallClocks</title>
      <link>https://dev.to/wallclocks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wallclocks"/>
    <language>en</language>
    <item>
      <title>Enable Buzzer in Klipper For Creality Boards 4.2.2 4.2.7</title>
      <dc:creator>WallClocks</dc:creator>
      <pubDate>Tue, 28 Dec 2021 02:44:59 +0000</pubDate>
      <link>https://dev.to/wallclocks/enable-buzzer-in-klipper-for-creality-boards-422-427-19mg</link>
      <guid>https://dev.to/wallclocks/enable-buzzer-in-klipper-for-creality-boards-422-427-19mg</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yyo32n9e3d8ze0vc6pb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4yyo32n9e3d8ze0vc6pb.png" alt="creality_board_screenshot"&gt;&lt;/a&gt;&lt;br&gt;
I have an Ender 3 with a 4.2.7 Board running Klipper firmware and wanted to enable the Buzzer. After some looking around I found the &lt;a href="https://github.com/Klipper3d/klipper/blob/master/config/generic-creality-v4.2.7.cfg" rel="noopener noreferrer"&gt;sample-macros.cfg&lt;/a&gt; and &lt;a href="https://github.com/Jyers/Marlin/discussions/814" rel="noopener noreferrer"&gt;PDF schematics for both 4.2.2 and 4.2.7&lt;/a&gt;. Using these two things I was able to make the M300 gcode command trigger the Buzzer in the LCD panel.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;

&lt;span class="c"&gt;######################################################################&lt;/span&gt;
&lt;span class="c"&gt;# Beeper&lt;/span&gt;
&lt;span class="c"&gt;######################################################################&lt;/span&gt;
&lt;span class="c"&gt;# M300 : Play tone. Beeper support, as commonly found on usual LCD&lt;/span&gt;
&lt;span class="c"&gt;# displays (i.e. RepRapDiscount 2004 Smart Controller, RepRapDiscount&lt;/span&gt;
&lt;span class="c"&gt;# 12864 Full Graphic). This defines a custom I/O pin and a custom&lt;/span&gt;
&lt;span class="c"&gt;# GCODE macro.  Usage:&lt;/span&gt;
&lt;span class="c"&gt;#   M300 [P&amp;lt;ms&amp;gt;] [S&amp;lt;Hz&amp;gt;]&lt;/span&gt;
&lt;span class="c"&gt;#   P is the tone duration, S the tone frequency.&lt;/span&gt;
&lt;span class="c"&gt;# The frequency won't be pitch perfect.&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;output_pin BEEPER_pin]
pin: PC6
&lt;span class="c"&gt;#   Beeper pin. This parameter must be provided.&lt;/span&gt;
&lt;span class="c"&gt;#   ar37 is the default RAMPS/MKS pin.&lt;/span&gt;
pwm: True
&lt;span class="c"&gt;#   A piezo beeper needs a PWM signal, a DC buzzer doesn't.&lt;/span&gt;
value: 0
&lt;span class="c"&gt;#   Silent at power on, set to 1 if active low.&lt;/span&gt;
shutdown_value: 0
&lt;span class="c"&gt;#   Disable at emergency shutdown (no PWM would be available anyway).&lt;/span&gt;
cycle_time: 0.001
&lt;span class="c"&gt;#   Default PWM frequency : 0.001 = 1ms will give a tone of 1kHz&lt;/span&gt;
&lt;span class="c"&gt;#   Although not pitch perfect.&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;gcode_macro M300]
gcode:
    &lt;span class="c"&gt;# Use a default 1kHz tone if S is omitted.&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;% &lt;span class="nb"&gt;set &lt;/span&gt;S &lt;span class="o"&gt;=&lt;/span&gt; params.S|default&lt;span class="o"&gt;(&lt;/span&gt;1000&lt;span class="o"&gt;)&lt;/span&gt;|int %&lt;span class="o"&gt;}&lt;/span&gt;
    &lt;span class="c"&gt;# Use a 10ms duration is P is omitted.&lt;/span&gt;
    &lt;span class="o"&gt;{&lt;/span&gt;% &lt;span class="nb"&gt;set &lt;/span&gt;P &lt;span class="o"&gt;=&lt;/span&gt; params.P|default&lt;span class="o"&gt;(&lt;/span&gt;100&lt;span class="o"&gt;)&lt;/span&gt;|int %&lt;span class="o"&gt;}&lt;/span&gt;
    SET_PIN &lt;span class="nv"&gt;PIN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;BEEPER_pin &lt;span class="nv"&gt;VALUE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0.5 &lt;span class="nv"&gt;CYCLE_TIME&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt; 1.0/S &lt;span class="k"&gt;if &lt;/span&gt;S &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 0 &lt;span class="k"&gt;else &lt;/span&gt;1 &lt;span class="o"&gt;}&lt;/span&gt;
    G4 P&lt;span class="o"&gt;{&lt;/span&gt;P&lt;span class="o"&gt;}&lt;/span&gt;
    SET_PIN &lt;span class="nv"&gt;PIN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;BEEPER_pin &lt;span class="nv"&gt;VALUE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To check that it is working, send &lt;code&gt;M300 S440 P200&lt;/code&gt; to your printer and it should beep. You can learn more &lt;a href="https://marlinfw.org/docs/gcode/M300.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The only thing you need to change from the sample-macros.cfg section is the pin. Under &lt;code&gt;[output_pin BEEPER_pin]&lt;/code&gt; you set &lt;code&gt;pin:PC6&lt;/code&gt;. That is it. &lt;br&gt;
Seems simple but I couldn't find anything online about it so I thought I would share. Hope this helps someone or me in the future at least.&lt;/p&gt;

</description>
      <category>klipper</category>
      <category>creality</category>
      <category>ender3</category>
      <category>m300</category>
    </item>
    <item>
      <title>Run Klipper/OctoPrint In Void Linux</title>
      <dc:creator>WallClocks</dc:creator>
      <pubDate>Wed, 24 Nov 2021 01:42:52 +0000</pubDate>
      <link>https://dev.to/wallclocks/run-klipperoctoprint-in-void-linux-4pbe</link>
      <guid>https://dev.to/wallclocks/run-klipperoctoprint-in-void-linux-4pbe</guid>
      <description>&lt;p&gt;This is a guide for installing Klipper and Octoprint on Void Linux&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bXvRu789--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q19x0bgit0ccd8a8czv4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bXvRu789--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q19x0bgit0ccd8a8czv4.png" alt="octovoid_v1" width="880" height="715"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It is broken into 3 sections,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Installing &lt;strong&gt;Klipper&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Installing &lt;strong&gt;Octoprint&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Installing &lt;strong&gt;Webcam&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each Section is broken into numbered steps. It is a lot but very dueable, it is mostly copy+paste. That said you should always try and understand what you paste into your console.&lt;/p&gt;


&lt;h2&gt;
  
  
  Klipper
&lt;/h2&gt;

&lt;p&gt;I am assuming you have a &lt;code&gt;printer.cfg&lt;/code&gt; file in your home directory, your printer is connted via USB and you know kinda how to use a terminal.&lt;/p&gt;

&lt;p&gt;I have made a new user &lt;code&gt;pi&lt;/code&gt;, to keep things as close to the raspberry-pi setup as I can. I recommend you do this as well.&lt;/p&gt;

&lt;p&gt;To make a new user&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;### Login as root
su
# create the new user
useradd -m -G dialout,tty -s /bin/bash pi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;make sure the user pi is part of the dialout and tty groups&lt;/strong&gt;&lt;br&gt;
Add this user to sudoers with &lt;code&gt;visudo&lt;/code&gt; command, google if you need help with vi or install nano and run &lt;code&gt;EDITOR=nano visudo&lt;/code&gt; from root.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You will need python2 for this to run and python3 to set it up. As of writing this python2 in Void Linux is called &lt;code&gt;python&lt;/code&gt; in xbps and python3 is &lt;code&gt;python3&lt;/code&gt;. I think they are working on making everything python3 and there is a python3 branch that I have tested and works without Python2 but I am not sure how complete that is. &lt;/p&gt;

&lt;h3&gt;
  
  
  Now that the user is set up and you are logged in as pi, do the following....
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Install system dependencies
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;xbps-install &lt;span class="nt"&gt;-S&lt;/span&gt; python python3 python3-pip python3-devel python3-setuptools git base-devel libffi-devel libyaml-devel avrdude avr-gcc avr-binutils avr-libc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Clone Klipper Repo from github
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/
git clone https://github.com/Klipper3d/klipper.git klipper
&lt;span class="nb"&gt;cd &lt;/span&gt;klipper
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Setup python-venv
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
&lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Dependencies
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./venv/bin/python &lt;span class="nt"&gt;-m&lt;/span&gt; pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--upgrade&lt;/span&gt; pip
./venv/bin/pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; scripts/klippy-requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create runsv service(runit) direcotry and file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; /etc/sv/klipper
&lt;span class="nb"&gt;sudo touch&lt;/span&gt; /etc/sv/klipper/run
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; +x /etc/sv/klipper/run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Edit the file &lt;code&gt;/etc/sv/klipper/run&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pi
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/home/pi
&lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-Gn&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="s1"&gt;':'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;exec &lt;/span&gt;chpst &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;$groups&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/klipper/venv/bin/python &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/klipper/klippy/klippy.py &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/printer.cfg &lt;span class="nt"&gt;-l&lt;/span&gt; /tmp/klippy.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Enable klipper
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-srv&lt;/span&gt; /etc/sv/klipper /var/service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;It be a good idea to reboot too.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After this plug in your printer if is not already, make sure you have your printer.cfg in your home dir, &lt;code&gt;sudo sv restart klipper&lt;/code&gt; and you should be connected. I have an ender 3 with LCD enabled so I could confirm at this point that the LCD menu works. On to OctoPrint.&lt;/p&gt;




&lt;h2&gt;
  
  
  OctoPrint
&lt;/h2&gt;

&lt;p&gt;All of the dependencies got installed in the Klipper install, so this is pretty simple.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;make the directory
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~
&lt;span class="nb"&gt;mkdir &lt;/span&gt;OctoPrint &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;OctoPrint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Setup Python3 venv
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python3 &lt;span class="nt"&gt;-m&lt;/span&gt; venv venv
&lt;span class="nb"&gt;source &lt;/span&gt;venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install Octoprint
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./venv/bin/pip &lt;span class="nb"&gt;install &lt;/span&gt;pip &lt;span class="nt"&gt;--upgrade&lt;/span&gt;
./venv/bin/pip &lt;span class="nb"&gt;install &lt;/span&gt;octoprint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Create runsv service(runit) direcotry and file
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; /etc/sv/octoprint
&lt;span class="nb"&gt;sudo touch&lt;/span&gt; /etc/sv/octoprint/run
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; +x /etc/sv/octoprint/run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Edit the file &lt;code&gt;/etc/sv/octoprint/run&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pi
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/home/pi
&lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-Gn&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="s1"&gt;':'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;exec &lt;/span&gt;chpst &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;$groups&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;/OctoPrint/venv/bin/octoprint serve

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Enable Octoprint
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo ln -srv /etc/sv/octoprint /var/service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another restart might be good.&lt;/p&gt;

&lt;p&gt;Once you open Octoprint in the browser you should install the OctoKlipper plugin.&lt;/p&gt;

&lt;p&gt;By default the octoprint instance runs on port &lt;code&gt;5000&lt;/code&gt;. So something like &lt;code&gt;localhost:5000&lt;/code&gt; should get you there, or the ip of the machine with void.&lt;/p&gt;




&lt;h2&gt;
  
  
  Webcam
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Install some things&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;xbps-install subversion libjpeg-turbo-devel ffmpeg 
cmake
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Get the repo and build it&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/jacksonliam/mjpg-streamer.git
&lt;span class="nb"&gt;cd &lt;/span&gt;mjpg-streamer/mjpg-streamer-experimental
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;LD_LIBRARY_PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt;
make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Test it&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./mjpg_streamer &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"./input_uvc.so"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"./output_http.so -w ./www"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Press Control-C to exit&lt;br&gt;
You may have to add a device. in my case my laptop has a built in camera but I want to use the USB one, so I use(example)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./mjpg_streamer &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="s2"&gt;"./input_uvc.so -d /dev/video2"&lt;/span&gt; &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="s2"&gt;"./output_http.so -w ./www"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The `-d /dev/video2` part is different.
You can this will give you a video feed on port `8080`.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Setup Octoprint&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
In octoprint goto settings and webcam &amp;amp; timelapse section. In the "Stream URL" section put the &lt;a href="http://ip:port/?action=stream"&gt;http://ip:port/?action=stream&lt;/a&gt;, example &lt;code&gt;http://192.168.0.24:8080/?action=stream&lt;/code&gt;. &lt;br&gt;
If you want Timelapse enter the same &lt;a href="http://ip:port"&gt;http://ip:port&lt;/a&gt; part but with &lt;code&gt;/?action=snapshot&lt;/code&gt; at the end, example &lt;code&gt;http://192.168.0.24:8080/?action=snapshot&lt;/code&gt;&lt;br&gt;
You should know have a video feed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Setting it up to autostart. first make the files&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo mkdir&lt;/span&gt; /etc/sv/octocam
&lt;span class="nb"&gt;sudo touch&lt;/span&gt; /etc/sv/octocam/run
&lt;span class="nb"&gt;sudo chmod&lt;/span&gt; +x /etc/sv/octocam/run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Create a executable file that has the start command&lt;/strong&gt;
I had trouble getting this to work any other way I tried, you need to make a file, &lt;code&gt;/home/pi/bin/octocam_run&lt;/code&gt;, like so
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/bin
touch ~/bin/octocam_run
chmod +x ~/bin/octocam_run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Next, put the following into the &lt;code&gt;/home/pi/bin/octocam_run&lt;/code&gt; file&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

MJPGSTREAMER_HOME=/home/pi/mjpg-streamer/mjpg-streamer-experimental
camera_options="-r 640x480 -f 10"

pushd $MJPGSTREAMER_HOME
LD_LIBRARY_PATH=. ./mjpg_streamer -o "output_http.so -w ./www" -i "input_uvc.so $camera_options -d /dev/video2"
popd

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Add content to the &lt;code&gt;/etc/sv/octocam/run&lt;/code&gt; file&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;pi
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/home/pi
&lt;span class="nb"&gt;groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt; &lt;span class="nt"&gt;-Gn&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="s1"&gt;':'&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;exec &lt;/span&gt;chpst &lt;span class="nt"&gt;-u&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$USER&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;$groups&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; /home/pi/bin/octocam_run

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;last add it to your services&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-sv&lt;/span&gt; /etc/sv/octocam /var/service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have not, maybe do a reboot.&lt;/p&gt;

&lt;p&gt;Please let me know if I have messed anything up if there is a better way to do this. And any errors your eyes sea please.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sources&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Klipper Install
    - https://www.klipper3d.org/Installation.html
- Void Docs
    -https://docs.voidlinux.org/config/services/index.html
    - https://docs.voidlinux.org/config/services/user-services.html
- OcotPrint Help
    - https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian-or-raspberry-pi-os/2337
- And the install scripts from klipper, a few man pages here and there.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>X11 Special Keyboard Keys for Window Managers</title>
      <dc:creator>WallClocks</dc:creator>
      <pubDate>Sat, 15 May 2021 01:48:33 +0000</pubDate>
      <link>https://dev.to/wallclocks/x11-special-keyboard-keys-for-window-managers-4no2</link>
      <guid>https://dev.to/wallclocks/x11-special-keyboard-keys-for-window-managers-4no2</guid>
      <description>&lt;h1&gt;
  
  
  Keyboard Media Keys for Unix X11
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;AKA XF86keysym&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not knowing what the name of a key is, is a pain, so &lt;a href="https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h"&gt;here&lt;/a&gt; is a list of them and some useful ways to implement them. Original sources listed at bottom and wherever they show up.&lt;/p&gt;

&lt;p&gt;You can also control volume, brightness and maybe some others with &lt;strong&gt;acpi&lt;/strong&gt; event handlers.&lt;/p&gt;

&lt;p&gt;For a list of all available X11 media key names, look &lt;a href="https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h"&gt;here&lt;/a&gt;. This file comes with x11 development files. In Ubuntu it is obtained in the &lt;code&gt;xorg-dev&lt;/code&gt; package and lives in &lt;code&gt;/usr/include/X11/XF86keysym.h&lt;/code&gt;.&lt;br&gt;
For i3wm and awesome you remove the "XK_" part. so instead of &lt;code&gt;XF86XK_MonBrightnessUp&lt;/code&gt;, it would be &lt;code&gt;XF86MonBrightnessUp&lt;/code&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Control Volume
&lt;/h2&gt;

&lt;p&gt;Using Pulseaudio&lt;/p&gt;
&lt;h3&gt;
  
  
  i3wm
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Pulse Audio controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle # mute sound
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  awesome wm
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    awful.key({            }, "XF86AudioRaiseVolume" , function () awful.spawn("pactl set-sink-volume 0 +5%") end,
              {description = "Volume Up",      group = "awesome"}),
    awful.key({            }, "XF86AudioLowerVolume" , function () awful.spawn("pactl set-sink-volume 0 -5%") end,
              {description = "Volume Down", group = "awesome"}),
    awful.key({            }, "XF86AudioMute" , function () awful.spawn("pactl set-sink-mute 0 toggle") end,
              {description = "Volume Mute",  group = "awesome"}),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  dwm
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;X11/XF86keysym.h&amp;gt;

/* Add somewhere in your constants definition section */

static const char *upvol[]   = { "/usr/bin/pactl", "set-sink-volume", "0", "+5%",     NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-5%",     NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute",   "0", "toggle",  NULL };

/* Add to keys[] array. With 0 as modifier, you are able to use the keys directly. */
static Key keys[] = {
    { 0,                       XF86XK_AudioLowerVolume, spawn, {.v = downvol } },
    { 0,                       XF86XK_AudioMute, spawn, {.v = mutevol } },
    { 0,                       XF86XK_AudioRaiseVolume, spawn, {.v = upvol   } },
};

/* If you have a small laptop keyboard or don't want to spring your fingers too far away. */

static Key keys[] = {
    { MODKEY,                       XK_F11, spawn, {.v = downvol } },
    { MODKEY,                       XK_F9,  spawn, {.v = mutevol } },
    { MODKEY,                       XK_F12, spawn, {.v = upvol   } },
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  ALSA
&lt;/h3&gt;

&lt;p&gt;If you want to use alsa instead of pulse audio, you can use the amixer command. Here are the commands for volume up, down and mute toggle. Make sure to get the alsa-tools and alsa-utils packages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;amixer sset Master 5%+&lt;/li&gt;
&lt;li&gt;amixer sset Master 5%-&lt;/li&gt;
&lt;li&gt;amixer sset Master toggle
&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  ACPI
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Brightness and Volume&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is from &lt;a href="https://git.sr.ht/~djorborn/acpi_volume_brightness"&gt;here&lt;/a&gt;. If you use acpid and would rather use it then your window manager to control your volume and brightness, you can like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/etc/acpi/handler.sh

#!/bin/bash
# Default acpi script that takes an entry for all actions
#jack/headphone HEADPHONE unplug
#jack/headphone HEADPHONE plug

case "$1" in
    jack/headphone)
        case $3 in
            plug)
                echo "in" &amp;gt; /var/tmp/headphones.log
            ;;
            unplug)
                echo "out" &amp;gt; /var/tmp/headphones.log
            ;;
        esac
        ;;
    button/mute)
        /usr/local/bin/volume mute 
    ;;
button/volumedown)
        /usr/local/bin/volume vdown
    ;;
button/volumeup)
    /usr/local/bin/volume vup
    ;;
video/brightnessup)
    /usr/local/bin/brightness_push up
    ;;
video/brightnessdown)
    /usr/local/bin/brightness_push down
    ;;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above file I use the event handlers to call custom scripts in my $PATH. The first case is watching the headphone jack, when headphones get plugged in, a log file is made, if the files contents is &lt;code&gt;in&lt;/code&gt;, headphones are plugged in, out means unplugged. My volume script them looks at that file when I press the volume keys, it will choose to control the headphone volume instead of master. This was to resolve an issue on my hp stream when running alpine as a full blown desktop. &lt;br&gt;
 Anyway, here are the scripts in $PATH(like /usr/local/bin/) that get called.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; #!/bin/bash

refresh_i3status="killall -SIGUSR1 py3status"
headphone=$(cat /var/tmp/headphones.log)

case "$1" in
    up)
        #sudo -g audio pactl set-sink-volume @DEFAULT_SINK@ +10%;
        amixer sset Master 5%+
        $refresh_i3status

    ;;
    down)
        #sudo -g audio pactl set-sink-volume @DEFAULT_SINK@ -10%; 
        amixer sset Master 5%-
        $refresh_i3status
    ;;
    mute)
        #sudo -g audio pactl set-sink-mute @DEFAULT_SINK@ toggle; 
        amixer sset Master toggle
        if [[ $headphone == "in" ]]; then
            amixer sset Headphone unmute
        else
            amixer sset Speaker unmute
        fi
        $refresh_i3status
    ;;
    esac
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; #!/bin/bash

# Variables

brightness_dir=/sys/class/backlight/intel_backlight
brightness_file=$brightness_dir/brightness
brightness=$(cat $brightness_file)
actual_brightness=$(cat $brightness_dir/actual_brightness)
max_brightness=$(cat $brightness_dir/max_brightness)
min_brightness=50
n=50


if [[ "$1" == "up" ]]; then
    if (( $actual_brightness &amp;lt; $max_brightness )); then
        echo  $(dc -e "$actual_brightness $n + p") &amp;gt;&amp;gt; $brightness_file;
    fi
else
    if (( $actual_brightness &amp;gt; $min_brightness )); then
        echo  $(dc -e "$actual_brightness $n - p") &amp;gt;&amp;gt; $brightness_file;
    fi

fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Brightness Control
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;With xbacklight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Controling Brightness is a lot like contorling volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  i3wm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; # Screen Brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # increase screen brightness
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # decrease screen brightness

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  awesome wm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    awful.key({            }, "XF86MonBrightnessUp" , function () awful.spawn("xbacklight inc 5%") end,
              {description = "Brighness Up",      group = "awesome"}),
    awful.key({            }, "XF86MonBrightnessDown" , function () awful.spawn("xbacklight dec 5%") end,
              {description = "Brighness Down",      group = "awesome"}),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  dwm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; #include &amp;lt;X11/XF86keysym.h&amp;gt;

/* Add somewhere in your constants definition section */

static const char *upbrightness[]      = { "xbacklight", "inc", "5%",     NULL };
static const char *downbrightness[] = { "xbacklight", "dec", "5%",     NULL };

/* Add to keys[] array. With 0 as modifier, you are able to use the keys directly. */
static Key keys[] = {
    { 0,                       XF86XK_MonBrightnessDown, spawn, {.v = downbrightness } },
    { 0,                       XF86XK_MonBrightnessUp, spawn, {.v = upbrightness   } },
};

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  xbacklight Alternative
&lt;/h2&gt;

&lt;p&gt;This is from &lt;a href="https://gist.github.com/djorborn/02363a376f25b4147de06e5a53647bcd"&gt;here&lt;/a&gt;&lt;br&gt;
 If you have trouble with xbacklight or just don't like it, you can use a simple script, it goes into &lt;code&gt;/sys/class/backlight/{your screen}&lt;/code&gt;, gets the current brightness and changes it a set amount.&lt;br&gt;
 You have to change the &lt;code&gt;intel_backlight&lt;/code&gt; part if you do not use intel. You can find out, &lt;code&gt;ls /sys/class/backlight&lt;/code&gt;. Replace &lt;code&gt;intel_backlight&lt;/code&gt; with what ever you have.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

## Very simple way to change brightness without a utility.
## I made this to use with acpi event handlers and my laptop keyboard
## GNU General Public License
## dosborn at vivaldi dot net

# Variables

# brightness_dir= Direcotry containing the backlight file
brightness_dir=/sys/class/backlight/intel_backlight
# brightness_file= the file named brightness in that dir
brightness_file=$brightness_dir/brightness
# brightness= The contents of that file
brightness=$(cat $brightness_file)
# actual_brightness= the actual_brightness file
actual_brightness=$(cat $brightness_dir/actual_brightness)
# max_brightness= the contents of max_brightness
max_brightness=$(cat $brightness_dir/max_brightness)
# min_brightness= how low you want it to get
min_brightness=50
# n= the change, how fast it goes up and down
n=50

## If `brightness_push.sh up` is called then it will go up "n". and 'down' for down.

if [[ "$1" == "up" ]]; then
    if (( $actual_brightness &amp;lt; $max_brightness )); then
        echo  $(dc -e "$actual_brightness $n + p") &amp;gt;&amp;gt; $brightness_file;
    fi
else
    if (( $actual_brightness &amp;gt; $min_brightness )); then
        echo  $(dc -e "$actual_brightness $n - p") &amp;gt;&amp;gt; $brightness_file;
    fi

fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;## Trackpad&lt;br&gt;
 Also form &lt;a href="https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html"&gt;here&lt;/a&gt;&lt;br&gt;
 I am leaving out the dwm from here, it is just like before but different keys.&lt;br&gt;
 ### i3wm&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--------
 # Touchpad controls
bindsym XF86TouchpadToggle exec /some/path/toggletouchpad.sh # toggle touchpad
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;### awesome wm&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     awful.key({            }, " XF86TouchpadToggle" , function () awful.spawn("/some/path/toggletouchpad.sh") end,
              {description = "Prev Track", group = "awesome"}),

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The script toggletouchpad.sh for toggling your touchpad should have following content:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
if synclient -l | grep "TouchpadOff .*=.*0" ; then
    synclient TouchpadOff=1 ;
else
    synclient TouchpadOff=0 ;
fi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Media player controls
&lt;/h2&gt;

&lt;h3&gt;
  
  
  i3wm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
#bindsym XF86AudioPlay exec playctl play-pause  # To toggle with a single key
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  awesome wm
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    awful.key({            }, "XF86AudioPlay" , function () awful.spawn("playerctl play-pause") end,
              {description = "Play Pause", group = "awesome"}),
    awful.key({            }, "XF86AudioNext" , function () awful.spawn("playerctl next") end,
              {description = "Next Track", group = "awesome"}),
    awful.key({            }, "XF86AudioPrev" , function () awful.spawn("playerctl previous") end,
              {description = "Prev Track", group = "awesome"}),
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Sources
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/palopezv/efd34059af6126ad970940bcc6a90f2e"&gt;https://gist.github.com/palopezv/efd34059af6126ad970940bcc6a90f2e&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h"&gt;https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git.sr.ht/%7Edjorborn/acpi_volume_brightness"&gt;https://git.sr.ht/~djorborn/acpi_volume_brightness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://gist.github.com/djorborn/02363a376f25b4147de06e5a53647bcd"&gt;https://gist.github.com/djorborn/02363a376f25b4147de06e5a53647bcd&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html"&gt;https://faq.i3wm.org/question/3747/enabling-multimedia-keys.1.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thank you everyone who has helped me learn a random thing here and there.&lt;/p&gt;

</description>
      <category>x11</category>
      <category>volumekeys</category>
      <category>specialkeys</category>
      <category>windowmanager</category>
    </item>
  </channel>
</rss>
