From f86bbb8ca5d3ba0d18e333cbe6cb57cc17e3ae07 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 25 Nov 2018 15:26:44 +0000 Subject: doc, examples --- samples/Plugins/HelloWorld.hs | 24 ----------------- samples/Plugins/helloworld.config | 12 --------- samples/padding-icon.sh | 56 --------------------------------------- samples/status.sh | 54 ------------------------------------- samples/xmobar.config | 38 -------------------------- samples/xmonadpropwrite.hs | 41 ---------------------------- 6 files changed, 225 deletions(-) delete mode 100644 samples/Plugins/HelloWorld.hs delete mode 100644 samples/Plugins/helloworld.config delete mode 100755 samples/padding-icon.sh delete mode 100755 samples/status.sh delete mode 100644 samples/xmobar.config delete mode 100644 samples/xmonadpropwrite.hs (limited to 'samples') diff --git a/samples/Plugins/HelloWorld.hs b/samples/Plugins/HelloWorld.hs deleted file mode 100644 index d2267ae..0000000 --- a/samples/Plugins/HelloWorld.hs +++ /dev/null @@ -1,24 +0,0 @@ ------------------------------------------------------------------------------ --- | --- Module : Plugins.HelloWorld --- Copyright : (c) Andrea Rossato --- License : BSD-style (see LICENSE) --- --- Maintainer : Jose A. Ortega Ruiz --- Stability : unstable --- Portability : unportable --- --- A plugin example for Xmobar, a text based status bar --- ------------------------------------------------------------------------------ - -module Xmobar.Plugins.HelloWorld where - -import Xmobar.Plugins - -data HelloWorld = HelloWorld - deriving (Read, Show) - -instance Exec HelloWorld where - alias HelloWorld = "helloWorld" - run HelloWorld = return "Hello World!!" diff --git a/samples/Plugins/helloworld.config b/samples/Plugins/helloworld.config deleted file mode 100644 index 3818bfa..0000000 --- a/samples/Plugins/helloworld.config +++ /dev/null @@ -1,12 +0,0 @@ -Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" - , bgColor = "#000000" - , fgColor = "#BFBFBF" - , position = TopW C 90 - , commands = [ Run Cpu [] 10 - , Run Weather "LIPB" [] 36000 - , Run HelloWorld - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%cpu% } %helloWorld% { %LIPB% | %date%" - } diff --git a/samples/padding-icon.sh b/samples/padding-icon.sh deleted file mode 100755 index 31f5eeb..0000000 --- a/samples/padding-icon.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Detects the width of running window with name given as first -# argument (xprop name '$1') and creates an XPM icon of that width, -# 1px height, and transparent. Outputs an -tag for use in -# xmobar to display the generated XPM icon. -# -# Run script from xmobar and trayer: -# `Run Com "/where/ever/padding-icon.sh" ["panel"] "trayerpad" 10` -# and use `%trayerpad%` in your template. -# or, if you're using for instance stalonetray: -# `Run Com "/where/ever/padding-icon.sh" ["stalonetray"] "tray" 10` - -# Very heavily based on Jonas Camillus Jeppensen code -# https://github.com/jaor/xmobar/issues/239#issuecomment-233206552 - -# Function to create a transparent Wx1 px XPM icon -create_xpm_icon () { -timestamp=$(date) -pixels=$(for i in `seq $1`; do echo -n "."; done) - -cat << EOF > "$2" -/* XPM * -static char * trayer_pad_xpm[] = { -/* This XPM icon is used for padding in xmobar to */ -/* leave room for trayer-srg. It is dynamically */ -/* updated by by trayer-pad-icon.sh which is run */ -/* by xmobar. */ -/* Created: ${timestamp} */ -/* */ -"$1 1 1 1", -/* Colors (none: transparent) */ -". c none", -/* Pixels */ -"$pixels" -}; -EOF -} - -# panel window name -pname=${1:-panel} - -# Width of the trayer window -width=$(xprop -name $pname | grep 'program specified minimum size' | cut -d ' ' -f 5) - -# Icon file name -iconfile="/tmp/$pname-padding-${width:-0}px.xpm" - -# If the desired icon does not exist create it -if [ ! -f $iconfile ] -then - create_xpm_icon $width $iconfile -fi - -# Output the icon tag for xmobar -echo "" diff --git a/samples/status.sh b/samples/status.sh deleted file mode 100755 index 94e8fe7..0000000 --- a/samples/status.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash - -STATUSPIPE="/tmp/xmobar_status_jrk" - -function isMuted () { - # retrieve mute status - # return an arbitrary string for true or nothing at all - echo -} - -function getPercent () { - # somehow retrieve the percent value as plain int (e.g. "66") - echo "66" -} - -function percentBar () { - local i=1 res= - normal=47 high=80 - fgColor='#657b83' mutedColor='#cb4b16' - lowColor='#859900' midColor='#b58900' - highColor='#cb4b16' - - bar="$(echo -ne "\u2588")" - percent="$( getPercent )" - muted="$( isMuted )" - - if [ -n "$muted" ]; then - res="" - else - res="" - fi - - while [ $i -lt $percent ]; do - if [ $i -eq $normal -a -z "$muted" ]; then - res+="" - elif [ $i -eq $high -a -z "$muted" ]; then - res+="" - fi - - res+=$bar - i=$((i+1)) - done - - res+="" - - while [ $i -lt 100 ]; do - res+='-' - i=$((i+1)) - done - - echo "$res" -} - -echo "$( percentBar )" > "$STATUSPIPE" diff --git a/samples/xmobar.config b/samples/xmobar.config deleted file mode 100644 index c0d4cdc..0000000 --- a/samples/xmobar.config +++ /dev/null @@ -1,38 +0,0 @@ -Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*" - , additionalFonts = [] - , borderColor = "black" - , border = TopB - , bgColor = "black" - , fgColor = "grey" - , alpha = 255 - , position = Top - , textOffset = -1 - , iconOffset = -1 - , lowerOnStart = True - , pickBroadest = False - , persistent = False - , hideOnStart = False - , iconRoot = "." - , allDesktops = True - , overrideRedirect = True - , commands = [ Run Weather "EGPF" ["-t",": C", - "-L","18","-H","25", - "--normal","green", - "--high","red", - "--low","lightblue"] 36000 - , Run Network "eth0" ["-L","0","-H","32", - "--normal","green","--high","red"] 10 - , Run Network "eth1" ["-L","0","-H","32", - "--normal","green","--high","red"] 10 - , Run Cpu ["-L","3","-H","50", - "--normal","green","--high","red"] 10 - , Run Memory ["-t","Mem: %"] 10 - , Run Swap [] 10 - , Run Com "uname" ["-s","-r"] "" 36000 - , Run Date "%a %b %_d %Y %H:%M:%S" "date" 10 - ] - , sepChar = "%" - , alignSep = "}{" - , template = "%cpu% | %memory% * %swap% | %eth0% - %eth1% }\ - \{ %date%| %EGPF% | %uname%" - } diff --git a/samples/xmonadpropwrite.hs b/samples/xmonadpropwrite.hs deleted file mode 100644 index f3f4a5d..0000000 --- a/samples/xmonadpropwrite.hs +++ /dev/null @@ -1,41 +0,0 @@ --- Copyright Spencer Janssen --- Tomas Janousek --- BSD3 (see LICENSE) --- --- Reads from standard input and writes to an X propery on root window. --- To be used with XPropertyLog: --- Add it to commands: --- Run XPropertyLog "_XMONAD_LOG_CUSTOM" --- Add it to the template: --- template = "... %_XMONAD_LOG_CUSTOM% ..." --- Run: --- $ blah blah | xmonadpropwrite _XMONAD_LOG_CUSTOM - -import Control.Monad -import Graphics.X11 -import Graphics.X11.Xlib.Extras -import qualified Data.ByteString as B -import Foreign.C (CChar) -import System.IO -import System.Environment - -main = do - atom <- flip fmap getArgs $ \args -> case args of - [a] -> a - _ -> "_XMONAD_LOG" - - d <- openDisplay "" - xlog <- internAtom d atom False - ustring <- internAtom d "UTF8_STRING" False - - root <- rootWindow d (defaultScreen d) - - forever $ do - msg <- B.getLine - changeProperty8 d root xlog ustring propModeReplace (encodeCChar msg) - sync d True - - return () - -encodeCChar :: B.ByteString -> [CChar] -encodeCChar = map fromIntegral . B.unpack -- cgit v1.2.3