letting script display time in top bar ubuntu 18.04 LTSHow do I show date next to time in the panel with gnome-shell?Menu bar shows the word “Time” where current time should beTime is not displaying in the Top BarTime/date display on menu barHow to move the display time from the top center to the top right for Ubuntu 18.04Ubuntu 18.04 Gnome bar on all monitorsTime and date is missing on top bar of Ubuntu 18.04 LTSCan I make the top bar value changes using CLI with tweak?How to display custom formatted clock in top bar on multiple displays in Ubuntu 18.04?Time zone for Gnome Top Bar Ubuntu 18.10

Collected fruit by Seine's banks

Were days ever written as ordinal numbers when writing day-month-year?

My singleton can be called multiple times

Mathematica command that allows it to read my intentions

What do you call someone who asks many questions?

How can I prove that a state of equilibrium is unstable?

How to coordinate airplane tickets?

Am I breaking OOP practice with this architecture?

Why is the sentence "Das ist eine Nase" correct?

When handwriting 黄 (huáng; yellow) is it incorrect to have a disconnected 草 (cǎo; grass) radical on top?

How could sorcerers who are able to produce/manipulate almost all forms of energy communicate over large distances?

Any reason why UK visa biometrics suspended at USCIS ASC?

Do creatures with a speed 0ft., fly 30ft. (hover) ever touch the ground?

What is the difference between 'contrib' and 'non-free' packages repositories?

Should I tell management that I intend to leave due to bad software development practices?

What exactly is ineptocracy?

How badly should I try to prevent a user from XSSing themselves?

Could the museum Saturn V's be refitted for one more flight?

Notepad++ delete until colon for every line with replace all

In the UK, is it possible to get a referendum by a court decision?

How to install cross-compiler on Ubuntu 18.04?

Salesman text me from his personal phone

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

In Bayesian inference, why are some terms dropped from the posterior predictive?



letting script display time in top bar ubuntu 18.04 LTS


How do I show date next to time in the panel with gnome-shell?Menu bar shows the word “Time” where current time should beTime is not displaying in the Top BarTime/date display on menu barHow to move the display time from the top center to the top right for Ubuntu 18.04Ubuntu 18.04 Gnome bar on all monitorsTime and date is missing on top bar of Ubuntu 18.04 LTSCan I make the top bar value changes using CLI with tweak?How to display custom formatted clock in top bar on multiple displays in Ubuntu 18.04?Time zone for Gnome Top Bar Ubuntu 18.10













0















I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks



Edit: And here is the script if that is useful:



#!/usr/bin/python3

import datetime

d2 = 0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'

def time_round_to_5_minutes():

minute = datetime.datetime.now().minute
second = datetime.datetime.now().second

if minute % 5 * 60 + second < 150:
minute = minute - minute % 5
else:
minute = minute + 5 - minute % 5
minute = minute % 60

return minute

def time_in_norwegian():
hour = (datetime.datetime.now().hour + 2) % 24
minute = time_round_to_5_minutes()
d2[0] = 'Midnatt'
next_hour = True
if minute % 30 <= 15:
if minute == 45:
string = 'Kvart på '
elif minute == 30:
string = 'Halv '
elif minute == 0:
next_hour = False
elif minute < 20:
string = d2[minute] + ' over '
next_hour = False
if minute == 15:
string = 'Kvart over '
else:
string = d2[minute - 30] + ' over halv '
else:
if minute < 30:
string = d2[30-minute] + ' på halv '
else:
string = d2[60-minute] + ' på '

if next_hour == True:
hour = (hour + 1) % 24
if hour < 12:
am_pm = ' om morgenen'
else:
am_pm = ' om kvelden'
hour = hour % 12
string += d2[hour].lower() + am_pm


return string

print(time_in_norwegian())









share|improve this question









New contributor




tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    0















    I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks



    Edit: And here is the script if that is useful:



    #!/usr/bin/python3

    import datetime

    d2 = 0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'

    def time_round_to_5_minutes():

    minute = datetime.datetime.now().minute
    second = datetime.datetime.now().second

    if minute % 5 * 60 + second < 150:
    minute = minute - minute % 5
    else:
    minute = minute + 5 - minute % 5
    minute = minute % 60

    return minute

    def time_in_norwegian():
    hour = (datetime.datetime.now().hour + 2) % 24
    minute = time_round_to_5_minutes()
    d2[0] = 'Midnatt'
    next_hour = True
    if minute % 30 <= 15:
    if minute == 45:
    string = 'Kvart på '
    elif minute == 30:
    string = 'Halv '
    elif minute == 0:
    next_hour = False
    elif minute < 20:
    string = d2[minute] + ' over '
    next_hour = False
    if minute == 15:
    string = 'Kvart over '
    else:
    string = d2[minute - 30] + ' over halv '
    else:
    if minute < 30:
    string = d2[30-minute] + ' på halv '
    else:
    string = d2[60-minute] + ' på '

    if next_hour == True:
    hour = (hour + 1) % 24
    if hour < 12:
    am_pm = ' om morgenen'
    else:
    am_pm = ' om kvelden'
    hour = hour % 12
    string += d2[hour].lower() + am_pm


    return string

    print(time_in_norwegian())









    share|improve this question









    New contributor




    tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0


      1






      I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks



      Edit: And here is the script if that is useful:



      #!/usr/bin/python3

      import datetime

      d2 = 0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'

      def time_round_to_5_minutes():

      minute = datetime.datetime.now().minute
      second = datetime.datetime.now().second

      if minute % 5 * 60 + second < 150:
      minute = minute - minute % 5
      else:
      minute = minute + 5 - minute % 5
      minute = minute % 60

      return minute

      def time_in_norwegian():
      hour = (datetime.datetime.now().hour + 2) % 24
      minute = time_round_to_5_minutes()
      d2[0] = 'Midnatt'
      next_hour = True
      if minute % 30 <= 15:
      if minute == 45:
      string = 'Kvart på '
      elif minute == 30:
      string = 'Halv '
      elif minute == 0:
      next_hour = False
      elif minute < 20:
      string = d2[minute] + ' over '
      next_hour = False
      if minute == 15:
      string = 'Kvart over '
      else:
      string = d2[minute - 30] + ' over halv '
      else:
      if minute < 30:
      string = d2[30-minute] + ' på halv '
      else:
      string = d2[60-minute] + ' på '

      if next_hour == True:
      hour = (hour + 1) % 24
      if hour < 12:
      am_pm = ' om morgenen'
      else:
      am_pm = ' om kvelden'
      hour = hour % 12
      string += d2[hour].lower() + am_pm


      return string

      print(time_in_norwegian())









      share|improve this question









      New contributor




      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      I wrote a little script in Python to show the current time in words and simultaneously in Norwegian. So i would like to display that in the top bar of Ubuntu 18.04 lts instead of the standard time. Thanks



      Edit: And here is the script if that is useful:



      #!/usr/bin/python3

      import datetime

      d2 = 0: 'Null', 1: 'En', 2: 'To', 3: 'Tre', 4: 'Fire', 5: 'Fem', 6: 'Seks', 7: 'Sju', 8: 'Åtte', 9: 'Ni', 10: 'Ti', 11: 'Elleve', 12: 'Tolv', 13: 'Tretten', 14: 'Fjorten', 15: 'Femten', 16: 'Seksten', 17: 'Sytten', 18: 'Atten', 19: 'Nitten', 20: 'Tjue', 21: 'Tjueen', 30: 'Tretti', 40: 'Førti', 50: 'Femti', 22: 'Tjueto', 23: 'Tjuetre', 24: 'Tjuefire', 25: 'Tjuefem', 26: 'Tjueseks', 27: 'Tjuesju', 28: 'Tjueåtte', 29: 'Tjueni', 31: 'Trettien', 32: 'Trettito', 33: 'Trettitre', 34:'Trettifire', 35: 'Trettifem', 36: 'Trettiseks', 37: 'Trettisju', 38: 'Trettiåtte', 39: 'Trettini', 41: 'Førtien', 42: 'Førtito', 43: 'Førtitre', 44: 'Førtifire', 45: 'Førtifem', 46: 'Førtiseks', 47: 'Førtisju', 48: 'Førtiåtte', 49: 'Førtini', 51: 'Femtien', 52: 'Femtito', 53: 'Femtitre', 54: 'Femtifire', 55: 'Femtifem', 56: 'Femtiseks', 57: 'Femtisju', 58: 'Femtiåtte', 59: 'Femtini'

      def time_round_to_5_minutes():

      minute = datetime.datetime.now().minute
      second = datetime.datetime.now().second

      if minute % 5 * 60 + second < 150:
      minute = minute - minute % 5
      else:
      minute = minute + 5 - minute % 5
      minute = minute % 60

      return minute

      def time_in_norwegian():
      hour = (datetime.datetime.now().hour + 2) % 24
      minute = time_round_to_5_minutes()
      d2[0] = 'Midnatt'
      next_hour = True
      if minute % 30 <= 15:
      if minute == 45:
      string = 'Kvart på '
      elif minute == 30:
      string = 'Halv '
      elif minute == 0:
      next_hour = False
      elif minute < 20:
      string = d2[minute] + ' over '
      next_hour = False
      if minute == 15:
      string = 'Kvart over '
      else:
      string = d2[minute - 30] + ' over halv '
      else:
      if minute < 30:
      string = d2[30-minute] + ' på halv '
      else:
      string = d2[60-minute] + ' på '

      if next_hour == True:
      hour = (hour + 1) % 24
      if hour < 12:
      am_pm = ' om morgenen'
      else:
      am_pm = ' om kvelden'
      hour = hour % 12
      string += d2[hour].lower() + am_pm


      return string

      print(time_in_norwegian())






      python gnome-shell time






      share|improve this question









      New contributor




      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 min ago







      tor













      New contributor




      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 16 mins ago









      tortor

      11




      11




      New contributor




      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      tor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          tor is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130713%2fletting-script-display-time-in-top-bar-ubuntu-18-04-lts%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          tor is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          tor is a new contributor. Be nice, and check out our Code of Conduct.












          tor is a new contributor. Be nice, and check out our Code of Conduct.











          tor is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1130713%2fletting-script-display-time-in-top-bar-ubuntu-18-04-lts%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

          How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region

          Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü