Commit e99d07ae authored by epsi sayidina's avatar epsi sayidina
Browse files

herbstluftwm tags test

parent 4e93066e
......@@ -5,10 +5,7 @@
# libraries
DIR=$(dirname "$0")
. ${DIR}/gmc.sh
. ${DIR}/helper.sh
. ${DIR}/output.sh
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# initialize
......
......@@ -5,21 +5,19 @@
# libraries
DIR=$(dirname "$0")
. ${DIR}/gmc.sh
. ${DIR}/helper.sh
. ${DIR}/output.sh
. ${DIR}/pipehandler.sh
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# process handler
function test_dzen2() {
monitor=$1
local monitor=$1
shift
parameters=$@
local parameters=$@
command_out="dzen2 $parameters -p"
local command_out="dzen2 $parameters -p"
{
# initialize statusbar
......@@ -37,14 +35,13 @@ function test_dzen2() {
panel_height=24
get_monitor ${@}
# do `man herbsluftclient`, and type \pad to search what it means
herbstclient pad $monitor $panel_height 0 $panel_height 0
get_dzen2_parameters $monitor $panel_height
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# test
# do `man herbsluftclient`, and type \pad to search what it means
herbstclient pad $monitor $panel_height 0 $panel_height 0
# run process
test_dzen2 $monitor $dzen2_parameters
......@@ -42,12 +42,11 @@ function get_bottom_panel_geometry() {
local geometry=("$@")
# geometry has the format X Y W H
xpos=${geometry[0]}
xpos=$(( ${geometry[0]} + 0 ))
ypos=$(( ${geometry[3]} - $panel_height ))
width=${geometry[2]}
width=$(( ${geometry[2]} - 0 ))
height=$panel_height
}
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# dzen Parameters
......@@ -63,7 +62,7 @@ function get_dzen2_parameters() {
local font="-*-takaopgothic-medium-*-*-*-12-*-*-*-*-*-*-*"
dzen2_parameters=" -x $xpos -y $ypos -w $width -h $height"
dzen2_parameters+=" -fn $font"
dzen2_parameters+=" -ta l -bg $bgcolor -fg $fgcolor"
dzen2_parameters+=" -title-name dzentop"
dzen2_parameters+=" -fn $font"
}
......@@ -16,12 +16,11 @@ DIR=$(dirname "$0")
panel_height=24
get_monitor ${@}
get_dzen2_parameters $monitor $panel_height
# do `man herbsluftclient`, and type \pad to search what it means
herbstclient pad $monitor $panel_height 0 $panel_height 0
get_dzen2_parameters $monitor $panel_height
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# pipe
......
-- This is a modularized config for herbstluftwm tags in dzen2 statusbar
import System.Environment
import System.Process
import Data.List
import MyHelper
......@@ -22,4 +21,4 @@ main = do
geometry <- getGeometry monitor
let dzen2Parameters = getDzen2Parameters panelHeight geometry
print $ intercalate " " $ dzen2Parameters
putStrLn $ intercalate " " $ dzen2Parameters
......@@ -2,11 +2,10 @@
import System.Environment
import System.Process
import MyHelper
import System.IO
import GHC.IO.Handle
import MyHelper
import MyOutput
-- initialize
......@@ -43,16 +42,16 @@ main = do
args <- getArgs
let monitor = getMonitor args
-- do `man herbsluftclient`, and type \pad to search what it means
system $ "herbstclient pad " ++ show(monitor) ++ " "
++ show(panelHeight) ++ " 0 " ++ show(panelHeight) ++ " 0"
geometry <- getGeometry monitor
let dzen2Parameters = getDzen2Parameters panelHeight geometry
-- test
-- do `man herbsluftclient`, and type \pad to search what it means
system $ "herbstclient pad " ++ show(monitor) ++ " "
++ show(panelHeight) ++ " 0 " ++ show(panelHeight) ++ " 0"
-- run process
testDzen2 monitor dzen2Parameters
......
......@@ -55,9 +55,9 @@ getTopPanelGeometry
getBottomPanelGeometry :: Int -> [Int] -> XYWH
getBottomPanelGeometry
height geometry = XYWH
(show (geometry !! 0))
(show ((geometry !! 0) + 0))
(show ((geometry !! 3) - height))
(show (geometry !! 2))
(show ((geometry !! 2) - 0))
(show height)
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
......@@ -68,11 +68,11 @@ getDzen2Parameters
panelHeight geometry = [
"-x", xpos, "-y", ypos,
"-w", width, "-h", height,
"-fn", font,
"-ta", "l",
"-bg", bgcolor,
"-fg", fgcolor,
"-title-name", "dzentop"
"-title-name", "dzentop",
"-fn", font
]
where
XYWH xpos ypos width height = getTopPanelGeometry
......
......@@ -18,13 +18,13 @@ main = do
args <- getArgs
let monitor = getMonitor args
geometry <- getGeometry monitor
let dzen2Parameters = getDzen2Parameters panelHeight geometry
-- do `man herbsluftclient`, and type \pad to search what it means
system $ "herbstclient pad " ++ show(monitor) ++ " "
++ show(panelHeight) ++ " 0 " ++ show(panelHeight) ++ " 0"
geometry <- getGeometry monitor
let dzen2Parameters = getDzen2Parameters panelHeight geometry
-- main
......
......@@ -32,14 +32,14 @@ end
panel_height = 24
monitor = helper.get_monitor(arg)
-- do `man herbsluftclient`, and type \pad to search what it means
os.execute('herbstclient pad ' .. monitor .. ' '
.. panel_height .. ' 0 ' .. panel_height .. ' 0')
dzen2_parameters = helper.get_dzen2_parameters(monitor, panel_height)
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
-- test
-- do `man herbsluftclient`, and type \pad to search what it means
os.execute('herbstclient pad ' .. monitor .. ' '
.. panel_height .. ' 0 ' .. panel_height .. ' 0')
-- run process
test_dzen2(monitor, dzen2_parameters)
......@@ -15,7 +15,7 @@ function _M.split(inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={} ; i=0 -- zero based
local t={} ; i=1 -- non zero based
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
t[i] = str
i = i + 1
......
......@@ -33,12 +33,14 @@ end
function _M.get_top_panel_geometry(height, geometry)
-- geometry has the format X Y W H
return geometry[0], geometry[1], geometry[2], height
return tonumber(geometry[1]), tonumber(geometry[2]),
tonumber(geometry[3]), height
end
function _M.get_bottom_panel_geometry(height, geometry)
-- geometry has the format X Y W H
return geometry[0], (geometry[3]-height), geometry[2], height
return tonumber(geometry[1]) + 0, tonumber(geometry[4]) - height,
tonumber(geometry[3]) - 0, height
end
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
......@@ -54,11 +56,11 @@ function _M.get_dzen2_parameters(monitor, panel_height)
local font = '-*-takaopgothic-medium-*-*-*-12-*-*-*-*-*-*-*'
local parameters = ""
.. " -x "..xpos.." -y "..ypos
.. " -w "..width.." -h "..height
.. " -fn '"..font.."'"
.. " -ta l -bg '"..bgcolor.."' -fg '"..fgcolor.."'"
.. " -x " .. tostring(xpos) .. " -y " .. tostring(ypos)
.. " -w " .. tostring(width) .. " -h " .. tostring(height)
.. " -ta l -bg '" .. bgcolor .. "' -fg '" .. fgcolor .. "'"
.. " -title-name dzentop"
.. " -fn '" .. font .. "'"
return parameters
end
......
......@@ -43,8 +43,8 @@ _M.post_icon = '^fn()^fg()'
function _M.get_statusbar_text(monitor)
local text = ''
-- draw tags, zero based
for index = 0, #(_M.tags_status)-1 do
-- draw tags, non zero based
for index = 1, #(_M.tags_status) do
text = text .. _M.output_by_tag(monitor, _M.tags_status[index])
end
......
......@@ -12,13 +12,12 @@ local pipehandler = require('.pipehandler')
panel_height = 24
monitor = helper.get_monitor(arg)
dzen2_parameters = helper.get_dzen2_parameters(monitor, panel_height)
-- do `man herbsluftclient`, and type \pad to search what it means
os.execute('herbstclient pad ' .. monitor .. ' '
.. panel_height .. ' 0 ' .. panel_height .. ' 0')
dzen2_parameters = helper.get_dzen2_parameters(monitor, panel_height)
-- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- -----
-- main
......
......@@ -39,15 +39,14 @@ sub test_dzen2 {
my $panel_height = 24;
my $monitor = helper::get_monitor(@ARGV);
# do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
my $dzen2_parameters = helper::get_dzen2_parameters(
$monitor, $panel_height);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# test
# do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
# run process
test_dzen2($monitor, $dzen2_parameters);
......@@ -47,7 +47,8 @@ sub get_bottom_panel_geometry {
my @geometry = @_;
# geometry has the format X Y W H
return ($geometry[0], $geometry[3]-$height, $geometry[2], $height);
return ($geometry[0] + 0, $geometry[3] - $height,
$geometry[2] - 0, $height);
}
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
......@@ -66,9 +67,9 @@ sub get_dzen2_parameters {
my $font = '-*-takaopgothic-medium-*-*-*-12-*-*-*-*-*-*-*';
my $parameters = " -x $xpos -y $ypos -w $width -h $height"
. " -fn '$font'"
. " -ta l -bg '$bgcolor' -fg '$fgcolor'"
. " -title-name dzentop";
. " -title-name dzentop"
. " -fn '$font'";
return $parameters;
}
......
......@@ -15,13 +15,12 @@ use pipehandler;
my $panel_height = 24;
my $monitor = helper::get_monitor(@ARGV);
my $dzen2_parameters = helper::get_dzen2_parameters(
$monitor, $panel_height);
# do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
my $dzen2_parameters = helper::get_dzen2_parameters(
$monitor, $panel_height);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# main
......
......@@ -30,14 +30,13 @@ function test_dzen2($monitor, $parameters)
$panel_height = 24;
$monitor = get_monitor($argv);
// do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
$dzen2_parameters = get_dzen2_parameters($monitor, $panel_height);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# test
// do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
// run process
test_dzen2($monitor, $dzen2_parameters);
......@@ -36,7 +36,8 @@ function get_bottom_panel_geometry($height, $geometry)
{
// geometry has the format X Y W H
return array(
$geometry[0], ($geometry[3]-$height), $geometry[2], $height);
$geometry[0] + 0, ($geometry[3] - $height),
$geometry[2] - 0, $height);
}
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
......@@ -53,9 +54,9 @@ function get_dzen2_parameters($monitor, $panel_height)
$font = '-*-takaopgothic-medium-*-*-*-12-*-*-*-*-*-*-*';
$parameters = " -x $xpos -y $ypos -w $width -h $height"
. " -fn '$font'"
. " -ta l -bg '$bgcolor' -fg '$fgcolor'"
. " -title-name dzentop";
. " -title-name dzentop"
. " -fn '$font'";
return $parameters;
}
......@@ -10,12 +10,11 @@ require_once(__DIR__.'/pipehandler.php');
$panel_height = 24;
$monitor = get_monitor($argv);
$dzen2_parameters = get_dzen2_parameters($monitor, $panel_height);
// do `man herbsluftclient`, and type \pad to search what it means
system("herbstclient pad $monitor $panel_height 0 $panel_height 0");
$dzen2_parameters = get_dzen2_parameters($monitor, $panel_height);
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# main
......
#!/usr/bin/env python3
# This is a modularized config for herbstluftwm tags in dzen2 statusbar
import os
import sys
import helper
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment